tounit.js 782 B

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