import { beHidden, beVisible, haveText, beChecked, haveAttribute, haveClasses, haveValue, notBeChecked, notHaveAttribute, notHaveClasses, test, html } from '../../utils' test('class attribute bindings are merged by string syntax', html`
`, ({ get }) => { get('span').should(haveClasses(['foo'])) get('span').should(notHaveClasses(['bar'])) get('button').click() get('span').should(haveClasses(['foo'])) get('span').should(haveClasses(['bar'])) } ) test('class attribute bindings are added by string syntax', html`
`, ({ get }) => get('span').should(haveClasses(['foo'])) ) test('class attribute bindings are added by array syntax', html`
`, ({ get }) => get('span').should(haveClasses(['foo', 'bar'])) ) test('class attribute bindings are added by object syntax', html`
`, ({ get }) => { get('span').should(haveClasses(['foo', 'baz'])) get('span').should(haveClasses(['bar', 'border-blue-900'])) get('span').should(notHaveClasses(['border-red-900'])) get('button').click() get('span').should(haveClasses(['foo', 'baz'])) get('span').should(haveClasses(['bar', 'border-red-900'])) get('span').should(notHaveClasses(['border-blue-900'])) get('button').click() get('span').should(haveClasses(['baz'])) get('span').should(haveClasses(['bar', 'border-red-900'])) get('span').should(notHaveClasses(['foo'])) get('span').should(notHaveClasses(['border-blue-900'])) } ) test('classes are removed before being added', html`
Span
`, ({ get }) => { get('span').should(haveClasses(['block', 'text-red'])) get('button').click() get('span').should(haveClasses(['hidden', 'text-red'])) get('span').should(notHaveClasses(['block'])) } ) test('extra whitespace in class binding string syntax is ignored', html`
`, ({ get }) => get('span').should(haveClasses(['foo', 'bar'])) ) test('undefined class binding resolves to empty string', html`
should be red should be empty
`, ({ get }) => { get('span:nth-of-type(1)').should(haveClasses(['red'])) get('span:nth-of-type(2)').should(notHaveClasses(['red'])) } )