backgroundstyles.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import Styles from '../../../src/view/styles';
  6. describe( 'Background styles normalization', () => {
  7. let styles;
  8. beforeEach( () => {
  9. styles = new Styles();
  10. } );
  11. it( 'should normalize background', () => {
  12. // TODO: border-box given only for coverage test.
  13. styles.setStyle( 'background:url("example.jpg") center #f00 repeat-y fixed border-box;' );
  14. expect( styles.getNormalized( 'background' ) ).to.deep.equal( {
  15. attachment: 'fixed',
  16. image: 'url("example.jpg")',
  17. position: [ 'center' ],
  18. repeat: [ 'repeat-y' ],
  19. color: '#f00'
  20. } );
  21. } );
  22. // TODO: define what should happen with layers
  23. it.skip( 'should normalize background with layers', () => {
  24. styles.setStyle( 'background:url("test.jpg") repeat-y,#f00;' );
  25. expect( styles.getNormalized( 'background' ) ).to.deep.equal( { color: '#f00' } );
  26. } );
  27. it( 'should normalize background-color', () => {
  28. styles.setStyle( 'background-color:#f00;' );
  29. expect( styles.getNormalized( 'background' ) ).to.deep.equal( { color: '#f00' } );
  30. } );
  31. it( 'should output inline background-color style', () => {
  32. styles.setStyle( 'background:#f00;' );
  33. expect( styles.getInlineStyle() ).to.equal( 'background-color:#f00;' );
  34. expect( styles.getInlineProperty( 'background-color' ) ).to.equal( '#f00' );
  35. } );
  36. } );