diff options
Diffstat (limited to 'spec/frontend/polyfills/element_spec.js')
-rw-r--r-- | spec/frontend/polyfills/element_spec.js | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/spec/frontend/polyfills/element_spec.js b/spec/frontend/polyfills/element_spec.js deleted file mode 100644 index 64ce248ca44..00000000000 --- a/spec/frontend/polyfills/element_spec.js +++ /dev/null @@ -1,46 +0,0 @@ -import '~/commons/polyfills/element'; - -describe('Element polyfills', () => { - let testContext; - - beforeEach(() => { - testContext = {}; - }); - - beforeEach(() => { - testContext.element = document.createElement('ul'); - }); - - describe('matches', () => { - it('returns true if element matches the selector', () => { - expect(testContext.element.matches('ul')).toBeTruthy(); - }); - - it("returns false if element doesn't match the selector", () => { - expect(testContext.element.matches('.not-an-element')).toBeFalsy(); - }); - }); - - describe('closest', () => { - beforeEach(() => { - testContext.childElement = document.createElement('li'); - testContext.element.appendChild(testContext.childElement); - }); - - it('returns the closest parent that matches the selector', () => { - expect(testContext.childElement.closest('ul').toString()).toBe( - testContext.element.toString(), - ); - }); - - it('returns itself if it matches the selector', () => { - expect(testContext.childElement.closest('li').toString()).toBe( - testContext.childElement.toString(), - ); - }); - - it('returns undefined if nothing matches the selector', () => { - expect(testContext.childElement.closest('.no-an-element')).toBeFalsy(); - }); - }); -}); |