style.test.ts 621 B

123456789101112131415161718192021
  1. import { style } from './style';
  2. describe( 'styles', () => {
  3. test( 'can set an inline style', () => {
  4. const div = document.createElement( 'div' );
  5. style( div, 'color', 'red' );
  6. style( div, 'backgroundColor', 'white' );
  7. style( div, 'fontSize', '1rem' );
  8. expect( div.style.color ).toBe( 'red' );
  9. expect( div.style.backgroundColor ).toBe( 'white' );
  10. expect( div.style.fontSize ).toBe( '1rem' );
  11. } );
  12. test( 'can return a computed style', () => {
  13. const div = document.createElement( 'div' );
  14. div.style.color = 'red';
  15. expect( style( div, 'color' ) ).toBe( 'red' );
  16. } );
  17. } );