From 3d12b541c488ea09efced2fb987fcbf384c656bb Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 2 Oct 2019 11:43:54 +0200 Subject: return to the original file structure to avoid breaking modularity --- js/src/dom/selector-engine.spec.js | 115 ------------------------------------- 1 file changed, 115 deletions(-) delete mode 100644 js/src/dom/selector-engine.spec.js (limited to 'js/src/dom/selector-engine.spec.js') diff --git a/js/src/dom/selector-engine.spec.js b/js/src/dom/selector-engine.spec.js deleted file mode 100644 index 28ccdf40b..000000000 --- a/js/src/dom/selector-engine.spec.js +++ /dev/null @@ -1,115 +0,0 @@ -import SelectorEngine from './selector-engine' -import { makeArray } from '../util/index' - -/** Test helpers */ -import { getFixture, clearFixture } from '../../tests/helpers/fixture' - -describe('SelectorEngine', () => { - let fixtureEl - - beforeAll(() => { - fixtureEl = getFixture() - }) - - afterEach(() => { - clearFixture() - }) - - describe('matches', () => { - it('should return matched elements', () => { - fixtureEl.innerHTML = '
' - - expect(SelectorEngine.matches(fixtureEl, 'div')).toEqual(true) - }) - }) - - describe('find', () => { - it('should find elements', () => { - fixtureEl.innerHTML = '
' - - const div = fixtureEl.querySelector('div') - - expect(makeArray(SelectorEngine.find('div', fixtureEl))).toEqual([div]) - }) - - it('should find elements globaly', () => { - fixtureEl.innerHTML = '
' - - const div = fixtureEl.querySelector('#test') - - expect(makeArray(SelectorEngine.find('#test'))).toEqual([div]) - }) - - it('should handle :scope selectors', () => { - fixtureEl.innerHTML = `` - - const listEl = fixtureEl.querySelector('ul') - const aActive = fixtureEl.querySelector('.active') - - expect(makeArray(SelectorEngine.find(':scope > li > .active', listEl))).toEqual([aActive]) - }) - }) - - describe('findOne', () => { - it('should return one element', () => { - fixtureEl.innerHTML = '
' - - const div = fixtureEl.querySelector('#test') - - expect(SelectorEngine.findOne('#test')).toEqual(div) - }) - }) - - describe('children', () => { - it('should find children', () => { - fixtureEl.innerHTML = `` - - const list = fixtureEl.querySelector('ul') - const liList = makeArray(fixtureEl.querySelectorAll('li')) - const result = makeArray(SelectorEngine.children(list, 'li')) - - expect(result).toEqual(liList) - }) - }) - - describe('parents', () => { - it('should return parents', () => { - expect(SelectorEngine.parents(fixtureEl, 'body').length).toEqual(1) - }) - }) - - describe('prev', () => { - it('should return previous element', () => { - fixtureEl.innerHTML = '
' - - const btn = fixtureEl.querySelector('.btn') - const divTest = fixtureEl.querySelector('.test') - - expect(SelectorEngine.prev(btn, '.test')).toEqual([divTest]) - }) - - it('should return previous element with an extra element between', () => { - fixtureEl.innerHTML = [ - '
', - '', - '' - ].join('') - - const btn = fixtureEl.querySelector('.btn') - const divTest = fixtureEl.querySelector('.test') - - expect(SelectorEngine.prev(btn, '.test')).toEqual([divTest]) - }) - }) -}) - -- cgit v1.2.3