From c834895fa0e7d215ee8cb17b3efa8d0ce57a718c Mon Sep 17 00:00:00 2001 From: Johann-S Date: Sun, 24 Mar 2019 18:30:30 +0100 Subject: rewrite unit tests for selector engine --- js/tests/unit/dom/selector-engine.js | 77 ------------------------------------ 1 file changed, 77 deletions(-) delete mode 100644 js/tests/unit/dom/selector-engine.js (limited to 'js/tests') diff --git a/js/tests/unit/dom/selector-engine.js b/js/tests/unit/dom/selector-engine.js deleted file mode 100644 index 80bee7800..000000000 --- a/js/tests/unit/dom/selector-engine.js +++ /dev/null @@ -1,77 +0,0 @@ -$(function () { - 'use strict' - - QUnit.module('selectorEngine') - - QUnit.test('should be defined', function (assert) { - assert.expect(1) - assert.ok(SelectorEngine, 'Manipulator is defined') - }) - - QUnit.test('should determine if an element match the selector', function (assert) { - assert.expect(2) - $(' ').appendTo('#qunit-fixture') - - assert.ok(!SelectorEngine.matches($('#qunit-fixture')[0], '.btn')) - assert.ok(SelectorEngine.matches($('.btn')[0], '.btn')) - }) - - QUnit.test('should find the selector, according to an element or not', function (assert) { - assert.expect(3) - $(' ').appendTo('#qunit-fixture') - - var btn = $('.btn').first()[0] - assert.strictEqual(SelectorEngine.find($('.btn')), null) - assert.equal(SelectorEngine.find('.btn')[0], btn) - assert.equal(SelectorEngine.find('.btn', $('#qunit-fixture')[0])[0], btn) - }) - - QUnit.test('should find the first element which match the selector, according to an element or not', function (assert) { - assert.expect(3) - $(' ').appendTo('#qunit-fixture') - - var btn = $('.btn').first()[0] - assert.strictEqual(SelectorEngine.findOne($('.btn')), null) - assert.equal(SelectorEngine.findOne('.btn'), btn) - assert.equal(SelectorEngine.findOne('.btn', $('#qunit-fixture')[0]), btn) - }) - - QUnit.test('should find children', function (assert) { - assert.expect(2) - $(' ').appendTo('#qunit-fixture') - - assert.strictEqual(SelectorEngine.children($('.btn')), null) - assert.equal(SelectorEngine.children($('#qunit-fixture')[0], '.btn').length, 2) - }) - - QUnit.test('should find the selector in parents', function (assert) { - assert.expect(2) - - $('').appendTo('#qunit-fixture') - assert.strictEqual(SelectorEngine.parents($('.container')[0], {}), null) - assert.strictEqual(SelectorEngine.parents($('input')[0], 'body').length, 1) - }) - - QUnit.test('should find the closest element according to the selector', function (assert) { - assert.expect(2) - var html = - '
' + - ' ' + - '
' - - $(html).appendTo('#qunit-fixture') - assert.strictEqual(SelectorEngine.closest($('.btn')[0], {}), null) - assert.strictEqual(SelectorEngine.closest($('.btn')[0], '.test'), $('.test')[0]) - }) - - QUnit.test('should fin previous element', function (assert) { - assert.expect(2) - var html = - '
' + - '' - - $(html).appendTo('#qunit-fixture') - assert.strictEqual(SelectorEngine.prev($('.btn')[0], {}), null) - assert.strictEqual(SelectorEngine.prev($('.btn')[0], '.test')[0], $('.test')[0]) - }) -}) -- cgit v1.2.3