import projectX from 'project-x' global.MutationObserver = class { observe() {} } test('attribute bindings are set on initialize', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelector('span').getAttribute('foo')).toEqual('bar') }) test('class attribute bindings are removed by object syntax', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelector('span').classList.contains('foo')).toBeFalsy() }) test('class attribute bindings are added by object syntax', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelector('span').classList.contains('foo')).toBeTruthy() }) test('class attribute bindings are removed by array syntax', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelector('span').classList.contains('foo')).toBeFalsy() }) test('class attribute bindings are added by array syntax', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelector('span').classList.contains('foo')).toBeTruthy }) test('boolean attributes set to false are removed from element', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelectorAll('input')[0].disabled).toBeFalsy() expect(document.querySelectorAll('input')[1].checked).toBeFalsy() expect(document.querySelectorAll('input')[2].required).toBeFalsy() expect(document.querySelectorAll('input')[3].readOnly).toBeFalsy() expect(document.querySelectorAll('input')[4].hidden).toBeFalsy() }) test('boolean attributes set to true are added to element', async () => { document.body.innerHTML = `
` projectX.start() expect(document.querySelectorAll('input')[0].disabled).toBeTruthy() expect(document.querySelectorAll('input')[1].checked).toBeTruthy() expect(document.querySelectorAll('input')[2].required).toBeTruthy() expect(document.querySelectorAll('input')[3].readOnly).toBeTruthy() })