PHP Classes

File: public/js/tinymce/src/core/src/test/js/browser/util/ColorTest.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/core/src/test/js/browser/util/ColorTest.js   Download  
File: public/js/tinymce/src/core/src/test/js/browser/util/ColorTest.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,809 bytes
 

Contents

Class file image Download
asynctest( 'browser.tinymce.core.util.ColorTest', [ 'ephox.mcagar.api.LegacyUnit', 'ephox.agar.api.Pipeline', 'tinymce.core.util.Color' ], function (LegacyUnit, Pipeline, Color) { var success = arguments[arguments.length - 2]; var failure = arguments[arguments.length - 1]; var suite = LegacyUnit.createSuite(); suite.test("Constructor", function () { LegacyUnit.equal(new Color().toHex(), '#000000'); LegacyUnit.equal(new Color('#faebcd').toHex(), '#faebcd'); }); suite.test("parse method", function () { var color = new Color(); LegacyUnit.equal(color.parse('#faebcd').toHex(), '#faebcd'); LegacyUnit.equal(color.parse('#ccc').toHex(), '#cccccc'); LegacyUnit.equal(color.parse(' #faebcd ').toHex(), '#faebcd'); LegacyUnit.equal(color.parse('rgb(255,254,253)').toHex(), '#fffefd'); LegacyUnit.equal(color.parse(' rgb ( 255 , 254 , 253 ) ').toHex(), '#fffefd'); LegacyUnit.equal(color.parse({ r: 255, g: 254, b: 253 }).toHex(), '#fffefd'); LegacyUnit.equal(color.parse({ h: 359, s: 50, v: 50 }).toHex(), '#804041'); LegacyUnit.equal(color.parse({ r: 700, g: 700, b: 700 }).toHex(), '#ffffff'); LegacyUnit.equal(color.parse({ r: -1, g: -10, b: -20 }).toHex(), '#000000'); }); suite.test("toRgb method", function () { LegacyUnit.deepEqual(new Color('#faebcd').toRgb(), { r: 250, g: 235, b: 205 }); }); suite.test("toHsv method", function () { LegacyUnit.deepEqual(new Color('#804041').toHsv(), { h: 359, s: 50, v: 50 }); }); suite.test("toHex method", function () { LegacyUnit.equal(new Color({ r: 255, g: 254, b: 253 }).toHex(), '#fffefd'); }); Pipeline.async({}, suite.toSteps({}), function () { success(); }, failure); } );