PHP Classes

File: public/js/tinymce/src/ui/src/test/js/browser/SplitButtonTest.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/ui/src/test/js/browser/SplitButtonTest.js   Download  
File: public/js/tinymce/src/ui/src/test/js/browser/SplitButtonTest.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: 4,739 bytes
 

Contents

Class file image Download
asynctest( 'browser.tinymce.ui.SplitButtonTest', [ 'ephox.agar.api.Pipeline', 'ephox.mcagar.api.LegacyUnit', 'tinymce.core.dom.DOMUtils', 'tinymce.core.dom.EventUtils', 'tinymce.ui.test.UiUtils', 'tinymce.ui.test.ViewBlock', 'tinymce.ui.Api', 'tinymce.core.ui.Factory', 'tinymce.core.util.Tools' ], function (Pipeline, LegacyUnit, DOMUtils, EventUtils, UiUtils, ViewBlock, Api, Factory, Tools) { var success = arguments[arguments.length - 2]; var failure = arguments[arguments.length - 1]; var suite = LegacyUnit.createSuite(); var viewBlock = new ViewBlock(); // Registers ui widgets to factory Api.registerToFactory(); var createSplitButton = function (settings) { EventUtils.Event.clean(viewBlock.get()); viewBlock.update(''); return Factory.create(Tools.extend({ type: 'splitbutton' }, settings)).renderTo(viewBlock.get()).reflow(); }; suite.test("splitbutton text, size default", function () { var splitButton = createSplitButton({ text: 'X' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 42, 30], 4); }); suite.test("splitbutton text, size large", function () { var splitButton = createSplitButton({ text: 'X', size: 'large' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 57, 39], 4); }); suite.test("splitbutton text, size small", function () { var splitButton = createSplitButton({ text: 'X', size: 'small' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 36, 23], 4); }); suite.test("splitbutton text, width 100, height 100", function () { var splitButton = createSplitButton({ text: 'X', width: 100, height: 100 }); LegacyUnit.equal(UiUtils.rect(viewBlock, splitButton), [0, 0, 100, 100]); LegacyUnit.equal(UiUtils.rect(viewBlock, splitButton.getEl().firstChild), [1, 1, 83, 98]); }); suite.test("splitbutton icon, size default", function () { var splitButton = createSplitButton({ icon: 'test' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 50, 30], 4); }); suite.test("splitbutton icon, size small", function () { var splitButton = createSplitButton({ icon: 'test', size: 'small' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 45, 24], 4); }); suite.test("splitbutton icon, size large", function () { var splitButton = createSplitButton({ icon: 'test', size: 'large' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 63, 40], 4); }); suite.test("splitbutton icon, width 100, height 100", function () { var splitButton = createSplitButton({ icon: 'test', width: 100, height: 100 }); LegacyUnit.equal(UiUtils.rect(viewBlock, splitButton), [0, 0, 100, 100]); LegacyUnit.equal(UiUtils.rect(viewBlock, splitButton.getEl().firstChild), [1, 1, 83, 98]); }); suite.test("splitbutton text & icon, size default", function () { var splitButton = createSplitButton({ text: 'X', icon: 'test' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 62, 30], 4); }); suite.test("splitbutton text & icon, size large", function () { var splitButton = createSplitButton({ text: 'X', icon: 'test', size: 'large' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 78, 40], 4); }); suite.test("splitbutton text & icon, size small", function () { var splitButton = createSplitButton({ text: 'X', icon: 'test', size: 'small' }); UiUtils.nearlyEqualRects(UiUtils.rect(viewBlock, splitButton), [0, 0, 60, 24], 5); }); suite.test("splitbutton text & icon, width 100, height 100", function () { var splitButton = createSplitButton({ text: 'X', icon: 'test', width: 100, height: 100 }); LegacyUnit.equal(UiUtils.rect(viewBlock, splitButton), [0, 0, 100, 100]); LegacyUnit.equal(UiUtils.rect(viewBlock, splitButton.getEl().firstChild), [1, 1, 83, 98]); }); suite.test("splitbutton click event", function () { var splitButton, clicks = {}; splitButton = createSplitButton({ text: 'X', onclick: function () { clicks.a = 'a'; } }); splitButton.fire('click', { target: splitButton.getEl().firstChild }); LegacyUnit.equal(clicks, { a: 'a' }); }); UiUtils.loadSkinAndOverride(viewBlock, function () { Pipeline.async({}, suite.toSteps({}), function () { EventUtils.Event.clean(viewBlock.get()); viewBlock.detach(); success(); }, failure); }); } );