8
0

tounit.js 799 B

12345678910111213141516171819202122232425
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import toUnit from '../../src/dom/tounit';
  6. describe( 'toUnit', () => {
  7. it( 'should be a function', () => {
  8. expect( toUnit ).to.be.a( 'function' );
  9. } );
  10. it( 'should return a helper function', () => {
  11. expect( toUnit( 'foo' ) ).to.be.a( 'function' );
  12. } );
  13. describe( 'helper function', () => {
  14. it( 'should always add a trailing unit to the value', () => {
  15. expect( toUnit( 'px' )( null ) ).to.equal( 'nullpx' );
  16. expect( toUnit( 'em' )( undefined ) ).to.equal( 'undefinedem' );
  17. expect( toUnit( 'rem' )( '10' ) ).to.equal( '10rem' );
  18. expect( toUnit( '' )( 10 ) ).to.equal( '10' );
  19. } );
  20. } );
  21. } );