/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import qsaFactory from 'consul-ui/utils/dom/qsa-factory';
import { module, test } from 'qunit';
module('Unit | Utility | qsa factory', function () {
test('querySelectorAll is called on `document` when called with document', function (assert) {
assert.expect(2);
const expected = 'html';
const $$ = qsaFactory({
querySelectorAll: function (sel) {
assert.equal(sel, expected);
return true;
},
});
assert.ok($$(expected));
test('querySelectorAll is called on `context` when called with context', function (assert) {
const context = {
};
// this should never be called
return false;
assert.ok($$(expected, context));