x-bind:style.spec.js 760 B

1234567891011121314151617181920212223
  1. import { beHidden, beVisible, haveText, beChecked, haveAttribute, haveClasses, haveValue, notBeChecked, notHaveAttribute, notHaveClasses, test, html } from '../../utils'
  2. test('style attribute object binding',
  3. html`
  4. <div x-data>
  5. <span x-bind:style="{ color: 'red' }">I should be red</span>
  6. </div>
  7. `,
  8. ({ get }) => {
  9. get('span').should(haveAttribute('style', 'color: red;'))
  10. }
  11. )
  12. test('style attribute object bindings are merged with existing styles',
  13. html`
  14. <div x-data>
  15. <span style="display: block" x-bind:style="{ color: 'red' }">I should be red</span>
  16. </div>
  17. `,
  18. ({ get }) => {
  19. get('span').should(haveAttribute('style', 'display: block; color: red;'))
  20. }
  21. )