Best JavaScript code snippet using fast-check-monorepo
Button.js
Source:Button.js
1/* global expect, Ext, jasmine, spyOn */2topSuite("Ext.button.Button",3 ['Ext.Panel', 'Ext.button.Split', 'Ext.form.Label', 'Ext.app.ViewController',4 'Ext.app.ViewModel'],5function() {6 var proto = Ext.button.Button.prototype,7 button;8 9 function clickIt (event) {10 jasmine.fireMouseEvent(button.el.dom, event || 'click');11 }12 function destroyButton () {13 if (button) {14 button.destroy();15 }16 button = null;17 }18 function makeButton(config) {19 button = new Ext.button.Button(Ext.apply({20 text: 'Button'21 }, config));22 23 return button;24 }25 26 function createButton(config) {27 config = Ext.apply({28 renderTo: document.body29 }, config);30 31 return makeButton(config);32 }33 afterEach(destroyButton);34 35 it("should be isButton", function() {36 expect(proto.isButton).toBeTruthy();37 });38 it("should not be hidden", function() {39 expect(proto.hidden).toBeFalsy();40 });41 it("should not be disabled", function() {42 expect(proto.disabled).toBeFalsy();43 });44 it("should not be pressed", function() {45 expect(proto.pressed).toBeFalsy();46 });47 it("should not enableToggle", function() {48 expect(proto.enableToggle).toBeFalsy();49 });50 it("should have a menuAlign", function() {51 expect(proto.menuAlign).toEqual('tl-bl?');52 });53 it("should have a clickEvent", function() {54 expect(proto.clickEvent).toEqual('click');55 });56 it("should handleMouseEvents", function() {57 expect(proto.handleMouseEvents).toBeTruthy();58 });59 it("should have a tooltipType", function() {60 expect(proto.tooltipType).toEqual('qtip');61 });62 it("should have a baseCls", function() {63 expect(proto.baseCls).toEqual('x-btn');64 });65 it("should return a renderTpl", function() {66 expect(proto.renderTpl).toBeDefined();67 });68 it("should have a scale", function() {69 expect(proto.scale).toEqual('small');70 });71 it("should have a ui", function() {72 expect(proto.ui).toEqual('default');73 });74 it("should have a arrowAlign", function() {75 expect(proto.arrowAlign).toEqual('right');76 });77 describe("initComponent", function() {78 describe("toggleGroup", function() {79 it("if defined, it should enableToggle", function() {80 makeButton({81 toggleGroup: 'testgroup'82 });83 expect(button.enableToggle).toBeTruthy();84 });85 });86 describe("html config", function() {87 it("should use the html config if specified", function() {88 button = new Ext.button.Button({89 html: 'Foo'90 });91 expect(button.text).toBe('Foo');92 });93 it("should give precedence to the text config if both are specified", function() {94 makeButton({95 html: 'Foo',96 text: 'Bar'97 });98 expect(button.text).toBe('Bar');99 });100 });101 });102 describe("border", function() {103 it("should respect an explicit border cfg", function() {104 makeButton({105 border: false106 });107 var p = new Ext.panel.Panel({108 items: button109 });110 expect(button.border).toBe(false);111 p.destroy();112 });113 });114 describe("setUI", function() {115 beforeEach(function() {116 makeButton({117 text: 'Foo'118 });119 button.render(Ext.getBody());120 button.setUI('custom');121 });122 it("should remove x-btn-default-small class from main button element", function() { 123 expect(button.el).not.toHaveCls('x-btn-default-small');124 });125 it("should add x-btn-custom-small class to main button element", function() { 126 expect(button.el).toHaveCls('x-btn-custom-small');127 });128 it("should remove x-btn-wrap-default-small class from btnWrap", function() { 129 expect(button.btnWrap).not.toHaveCls('x-btn-wrap-default-small');130 });131 it("should add x-btn-wrap-custom-small class to btnWrap", function() { 132 expect(button.btnWrap).toHaveCls('x-btn-wrap-custom-small');133 });134 it("should remove x-btn-button-default-small class from btnEl", function() { 135 expect(button.btnEl).not.toHaveCls('x-btn-button-default-small');136 });137 it("should add x-btn-button-custom-small class to btnEl", function() { 138 expect(button.btnEl).toHaveCls('x-btn-button-custom-small');139 });140 it("should remove x-btn-icon-el-default-small class from btnIconEl", function() {141 expect(button.btnIconEl).not.toHaveCls('x-btn-icon-el-default-small');142 });143 it("should add x-btn-icon-el-custom-small class to btnIconEl", function() {144 expect(button.btnIconEl).toHaveCls('x-btn-icon-el-custom-small');145 });146 it("should remove x-btn-inner-default-small class from btnInnerEl", function() {147 expect(button.btnInnerEl).not.toHaveCls('x-btn-inner-default-small');148 });149 it("should add x-btn-inner-custom-small class to btnInnerEl", function() {150 expect(button.btnInnerEl).toHaveCls('x-btn-inner-custom-small');151 });152 });153 describe("setText", function() {154 it("should be able to set the text before rendering", function() {155 makeButton({156 text: 'Foo'157 });158 button.setText('Bar');159 button.render(Ext.getBody());160 expect(button.btnInnerEl.dom).hasHTML('Bar');161 });162 it("should set the text after rendering", function() {163 makeButton({164 text: 'Foo',165 renderTo: Ext.getBody()166 });167 button.setText('Bar');168 expect(button.btnInnerEl.dom).hasHTML('Bar');169 });170 it("should have a visible btnInnerEl if the text is empty and there is no icon", function() {171 makeButton({172 renderTo: Ext.getBody(),173 text: ''174 });175 expect(button.btnInnerEl.isVisible()).toBe(true);176 });177 it("should show the btnInnerEl if text is not empty", function() {178 makeButton({179 renderTo: Ext.getBody(),180 icon: 'resources/images/foo.gif',181 text: ''182 });183 // inner el starts off hidden because we have an icon184 expect(button.btnInnerEl.isVisible()).toBe(false);185 button.setText('Bar');186 expect(button.btnInnerEl.dom).hasHTML('Bar');187 expect(button.btnInnerEl.isVisible()).toBe(true);188 });189 it("should hide the btnInnerEl if text is empty and there is an icon", function() {190 makeButton({191 renderTo: Ext.getBody(),192 icon: 'resources/images/foo.gif',193 text: 'Foo'194 });195 // inner el starts off visible because we initially rendered with text196 expect(button.btnInnerEl.isVisible()).toBe(true);197 button.setText('');198 expect(button.btnInnerEl.isVisible()).toBe(false);199 });200 it("should not hide the btnInnerEl if text is emtpy and there is no icon", function() {201 makeButton({202 renderTo: Ext.getBody(),203 text: 'Foo'204 });205 expect(button.btnInnerEl.isVisible()).toBe(true);206 button.setText('');207 expect(button.btnInnerEl.isVisible()).toBe(true);208 });209 210 it("should render with a x-btn-text class on the btnEl when configured with text", function() {211 makeButton({212 renderTo: Ext.getBody(),213 text: 'Foo'214 });215 216 expect(button.btnEl).toHaveCls('x-btn-text');217 });218 it("should not render the x-btn-no-text class on the btnEl when configured with text", function() {219 makeButton({220 renderTo: Ext.getBody(),221 text: 'Foo'222 });223 expect(button.btnEl).not.toHaveCls('x-btn-no-text');224 });225 it("should not have a x-btn-text class on the btnEl when not configured with text", function() {226 makeButton({227 renderTo: Ext.getBody(),228 text: ''229 });230 expect(button.btnEl).not.toHaveCls('x-btn-text');231 });232 it("should have a x-btn-no-text class on the btnEl when not configured with text", function() {233 makeButton({234 renderTo: Ext.getBody(),235 text: ''236 });237 expect(button.btnEl).toHaveCls('x-btn-no-text');238 });239 240 it("should add the x-btn-text class and remove the x-btn-no-text class when setting the text", function() {241 makeButton({242 renderTo: Ext.getBody(),243 text: ''244 });245 button.setText('Foo');246 expect(button.btnEl).toHaveCls('x-btn-text');247 expect(button.btnEl).not.toHaveCls('x-btn-no-text');248 });249 250 it("should remove the x-btn-text class and add the x-btn-no-text class when setting empty text", function() {251 makeButton({252 renderTo: Ext.getBody(),253 text: 'Foo'254 });255 256 button.setText('');257 expect(button.btnEl).not.toHaveCls('x-btn-text');258 expect(button.btnEl).toHaveCls('x-btn-no-text');259 });260 it("should render a non breaking space when the text passed is empty", function() {261 makeButton({262 text: 'Foo',263 renderTo: Ext.getBody()264 });265 button.setText('');266 expect(button.btnInnerEl.dom.innerHTML.length).toBeGreaterThan(0);267 });268 it("should fire the textchange event", function() {269 var btn, old, newText;270 makeButton({271 text: 'Foo',272 renderTo: Ext.getBody()273 });274 button.on('textchange', function(a1, a2, a3) {275 btn = a1;276 old = a2;277 newText = a3;278 });279 button.setText('Bar');280 expect(btn).toBe(button);281 expect(old).toBe('Foo');282 expect(newText).toBe('Bar');283 });284 it("should not fire the textchange event if the text doesn't change", function() {285 var called = false;286 makeButton({287 text: 'Foo',288 renderTo: Ext.getBody()289 });290 button.on('textchange', function() {291 called = true;292 });293 button.setText('Foo');294 expect(called).toBe(false);295 });296 });297 describe("setIcon", function() {298 var fooIcon = 'resources/images/foo.gif',299 barIcon = 'resources/images/bar.gif';300 301 it("should be able to set the icon before rendering", function() {302 makeButton({303 icon: fooIcon304 });305 button.setIcon(barIcon);306 button.render(Ext.getBody());307 expect(button.btnIconEl.dom.style.backgroundImage.indexOf('bar')).toBeGreaterThan(-1);308 });309 it("should set the icon after rendering", function() {310 makeButton({311 icon: fooIcon,312 renderTo: Ext.getBody()313 });314 button.setIcon(barIcon);315 expect(button.btnIconEl.dom.style.backgroundImage.indexOf('bar')).toBeGreaterThan(-1);316 });317 it("should set the icon after rendering (no initial icon)", function() {318 makeButton({319 renderTo: Ext.getBody()320 });321 expect(button.btnIconEl.isVisible()).toBe(false);322 button.setIcon(barIcon);323 expect(button.btnIconEl.dom.style.backgroundImage.indexOf('bar')).toBeGreaterThan(-1);324 expect(button.btnIconEl.isVisible()).toBe(true);325 });326 it("should unset the icon after rendering", function() {327 makeButton({328 icon: fooIcon,329 renderTo: Ext.getBody()330 });331 expect(button.btnIconEl.isVisible()).toBe(true);332 button.setIcon(null);333 expect(button.btnIconEl.dom.style.backgroundImage.indexOf('foo')).toBe(-1);334 expect(button.btnIconEl.isVisible()).toBe(false);335 });336 it("should fire the iconchange event", function() {337 var btn, old, newIcon;338 makeButton({339 icon: fooIcon,340 renderTo: Ext.getBody()341 });342 button.on('iconchange', function(a1, a2, a3) {343 btn = a1;344 old = a2;345 newIcon = a3;346 });347 button.setIcon(barIcon);348 expect(btn).toBe(button);349 expect(old).toBe(fooIcon);350 expect(newIcon).toBe(barIcon);351 });352 it("should not fire the iconchange event if the icon doesn't change", function() {353 var called = false;354 makeButton({355 icon: fooIcon,356 renderTo: Ext.getBody()357 });358 button.on('iconchange', function() {359 called = true;360 });361 button.setIcon(fooIcon);362 expect(called).toBe(false);363 });364 it("should switch from using glyph to icon", function() {365 makeButton({366 glyph: 'x48@FontAwesome',367 renderTo: Ext.getBody()368 });369 // Hex 48 is "H". Must switch to using that with no background image370 expect(button.btnIconEl.getStyle('font-family')).toBe('FontAwesome');371 expect(button.btnIconEl.dom.innerHTML).toBe('H');372 button.setIcon('resources/images/foo.gif');373 // No glyph character374 expect(button.btnIconEl.dom.innerHTML).toBe('');375 // iconEl must use the image as the background image.376 // Some browsers quote the url value, some don't. Remove quotes.377 expect(Ext.String.endsWith(button.btnIconEl.getStyle('background-image').replace(/\"/g, ''), 'resources/images/foo.gif)')).toBe(true);378 });379 it("should switch from using iconCls to icon", function() {380 makeButton({381 iconCls: 'foo-icon-class',382 renderTo: Ext.getBody()383 });384 // iconEl must use the specified icon class385 expect(button.btnIconEl.hasCls('foo-icon-class')).toBe(true);386 button.setIcon('resources/images/foo.gif');387 // Icon class must be gone388 expect(button.btnIconEl.hasCls('foo-icon-class')).toBe(false);389 // iconEl must use the image as the background image390 // Some browsers quote the url value, some don't. Remove quotes.391 expect(Ext.String.endsWith(button.btnIconEl.getStyle('background-image').replace(/\"/g, ''), 'resources/images/foo.gif)')).toBe(true);392 });393 });394 describe("setIconCls", function() {395 it("should be able to set the iconCls before rendering", function() {396 makeButton({397 iconCls: 'Foo'398 });399 button.setIconCls('Bar');400 button.render(Ext.getBody());401 expect(button.btnIconEl.hasCls('Bar')).toBe(true);402 });403 it("should set the iconCls after rendering", function() {404 makeButton({405 iconCls: 'Foo',406 renderTo: Ext.getBody()407 });408 button.setIconCls('Bar');409 expect(button.btnIconEl.hasCls('Bar')).toBe(true);410 });411 it("should set the iconCls after rendering (no initial iconCls)", function() {412 makeButton({413 renderTo: Ext.getBody()414 });415 expect(button.btnIconEl.isVisible()).toBe(false);416 button.setIconCls('Bar');417 expect(button.btnIconEl.hasCls('Bar')).toBe(true);418 expect(button.btnIconEl.isVisible()).toBe(true);419 });420 it("should unset the iconCls after rendering", function() {421 makeButton({422 iconCls: 'Foo',423 renderTo: Ext.getBody()424 });425 expect(button.btnIconEl.isVisible()).toBe(true);426 button.setIconCls(null);427 expect(button.btnIconEl.hasCls('Foo')).toBe(false);428 expect(button.btnIconEl.isVisible()).toBe(false);429 });430 it("should fire the iconchange event", function() {431 var btn, old, newIcon;432 makeButton({433 iconCls: 'Foo',434 renderTo: Ext.getBody()435 });436 button.on('iconchange', function(a1, a2, a3) {437 btn = a1;438 old = a2;439 newIcon = a3;440 });441 button.setIconCls('Bar');442 expect(btn).toBe(button);443 expect(old).toBe('Foo');444 expect(newIcon).toBe('Bar');445 });446 it("should not fire the iconchange event if the iconCls doesn't change", function() {447 var called = false;448 makeButton({449 iconCls: 'Foo',450 renderTo: Ext.getBody()451 });452 button.on('iconchange', function() {453 called = true;454 });455 button.setIconCls('Foo');456 expect(called).toBe(false);457 });458 it("should switch from using glyph to iconCls", function() {459 makeButton({460 glyph: 'x48@FontAwesome',461 renderTo: Ext.getBody()462 });463 // Hex 48 is "H". Must switch to using that with no background image464 expect(button.btnIconEl.getStyle('font-family')).toBe('FontAwesome');465 expect(button.btnIconEl.dom.innerHTML).toBe('H');466 button.setIconCls('foo-icon-class');467 // No glyph character468 expect(button.btnIconEl.dom.innerHTML).toBe('');469 // iconEl must use the specified icon class470 expect(button.btnIconEl.hasCls('foo-icon-class')).toBe(true);471 });472 it("should switch from using glyph to icon", function() {473 makeButton({474 glyph: 'x48@FontAwesome',475 renderTo: Ext.getBody()476 });477 // Hex 48 is "H". Must switch to using that with no background image478 expect(button.btnIconEl.getStyle('font-family')).toBe('FontAwesome');479 expect(button.btnIconEl.dom.innerHTML).toBe('H');480 button.setIcon('resources/images/foo.gif');481 // No glyph character482 expect(button.btnIconEl.dom.innerHTML).toBe('');483 // iconEl must use the image as the background image484 // Some browsers quote the url value, some don't. Remove quotes.485 expect(Ext.String.endsWith(button.btnIconEl.getStyle('background-image').replace(/\"/g, ''), 'resources/images/foo.gif)')).toBe(true);486 });487 });488 describe("setGlyph", function() {489 it("should be able to set the glyph before rendering", function() {490 makeButton({491 glyph: 65492 });493 button.setGlyph(66);494 button.render(Ext.getBody());495 expect(button.btnIconEl.dom.innerHTML).toBe('B');496 });497 it("should set the glyph after rendering", function() {498 makeButton({499 glyph: 65,500 renderTo: Ext.getBody()501 });502 button.setGlyph(66);503 expect(button.btnIconEl.dom.innerHTML).toBe('B');504 });505 it("should set the glyph after rendering (no initial glyph)", function() {506 makeButton({507 renderTo: Ext.getBody()508 });509 expect(button.btnIconEl.isVisible()).toBe(false);510 button.setGlyph(66);511 expect(button.btnIconEl.dom.innerHTML).toBe('B');512 expect(button.btnIconEl.isVisible()).toBe(true);513 });514 it("should unset the glyph after rendering", function() {515 makeButton({516 glyph: 65,517 renderTo: Ext.getBody()518 });519 expect(button.btnIconEl.isVisible()).toBe(true);520 button.setGlyph(null);521 expect(button.btnIconEl.dom.innerHTML).toBe('');522 expect(button.btnIconEl.isVisible()).toBe(false);523 });524 it("should fire the glyphchange event", function() {525 var btn, old, newGlyph;526 makeButton({527 glyph: 65,528 renderTo: Ext.getBody()529 });530 button.on('glyphchange', function(a1, a2, a3) {531 btn = a1;532 newGlyph = a2;533 old = a3;534 });535 button.setGlyph(66);536 expect(btn).toBe(button);537 expect(old).toBe(65);538 expect(newGlyph).toBe(66);539 });540 it("should switch from using icon to glyph", function() {541 makeButton({542 renderTo: Ext.getBody(),543 icon: 'resources/images/foo.gif',544 text: ''545 });546 // iconEl must use the image as the background image547 // Some browsers quote the url value, some don't. Remove quotes.548 expect(Ext.String.endsWith(button.btnIconEl.getStyle('background-image').replace(/\"/g, ''), 'resources/images/foo.gif)')).toBe(true);549 // Hex 48 is "H". Must switch to using that with no background image550 button.setGlyph('x48@FontAwesome');551 expect(button.btnIconEl.getStyle('background-image')).toBe('none');552 expect(button.btnIconEl.getStyle('font-family')).toBe('FontAwesome');553 expect(button.btnIconEl.dom.innerHTML).toBe('H');554 });555 it("should switch from using iconCls to glyph", function() {556 makeButton({557 renderTo: Ext.getBody(),558 iconCls: 'foo-icon-class',559 text: ''560 });561 // iconEl must use the image as the background image562 expect(button.btnIconEl.hasCls('foo-icon-class')).toBe(true);563 // Hex 48 is "H". Must switch to using that with no background image564 button.setGlyph('x48@FontAwesome');565 expect(button.btnIconEl.getStyle('background-image')).toBe('none');566 expect(button.btnIconEl.getStyle('font-family')).toBe('FontAwesome');567 expect(button.btnIconEl.dom.innerHTML).toBe('H');568 });569 });570 describe("setting the url", function() {571 function expectHref(href) {572 expect(button.getEl().dom.href.indexOf(href)).toBeGreaterThan(-1);573 }574 function expectEmptyHref() {575 expect(button.getEl().dom.href).toBe('');576 }577 var sencha = 'http://sencha.com',578 target = '_blank';579 describe("setHref", function() {580 function expectEmptyTarget() {581 expect(button.getEl().dom.href).toBe('');582 }583 function expectHrefTarget(target) {584 expect(button.getEl().dom.target).toBe(target);585 }586 describe("before render", function() {587 it("should be able to set the href before rendered", function() {588 makeButton({589 hrefTarget: target590 });591 button.setHref(sencha);592 button.render(Ext.getBody());593 expectHref('sencha.com');594 expectHrefTarget(target);595 });596 it("should overwrite a configured href", function() {597 makeButton({598 href: 'http://foo.com',599 hrefTarget: target600 });601 button.setHref(sencha);602 button.render(Ext.getBody());603 expectHref('sencha.com');604 expectHrefTarget(target);605 });606 it("should clear a configured href", function() {607 makeButton({608 href: sencha,609 hrefTarget: target610 });611 button.setHref('');612 button.render(Ext.getBody());613 expectEmptyHref();614 expectEmptyTarget();615 });616 it("should not set if configured disabled: true", function() {617 makeButton({618 disabled: true619 });620 button.setHref('');621 button.render(Ext.getBody());622 expectEmptyHref();623 });624 });625 describe("after render", function() {626 it("should set if no href is initially configured", function() {627 makeButton({628 renderTo: Ext.getBody(),629 hrefTarget: target630 });631 button.setHref(sencha);632 expectHref('sencha.com');633 expectHrefTarget(target);634 });635 it("should overwrite a configured href", function() {636 makeButton({637 renderTo: Ext.getBody(),638 href: 'http://foo.com',639 hrefTarget: target640 });641 button.setHref(sencha);642 expectHref('sencha.com');643 expectHrefTarget(target);644 });645 it("should clear a configured href", function() {646 makeButton({647 renderTo: Ext.getBody(),648 href: sencha,649 hrefTarget: target650 });651 button.setHref('');652 expectEmptyHref();653 expectEmptyTarget();654 });655 it("should not set the href on the element if disabled", function() {656 makeButton({657 renderTo: Ext.getBody(),658 hrefTarget: target,659 disabled: true660 });661 button.setHref(sencha);662 expectEmptyHref();663 expectEmptyTarget();664 });665 });666 });667 describe("setParams", function() {668 function getQueryString() {669 var href = button.getEl().dom.href,670 parts;671 if (href) {672 parts = href.split('?');673 if (parts.length === 2) {674 return Ext.Object.fromQueryString(parts[1]);675 }676 }677 return {};678 }679 // Since the url is string encoded we lose any type information680 describe("before render", function() {681 it("should be able to set the params", function() {682 makeButton({683 href: sencha684 });685 button.setParams({686 foo: 1687 });688 button.render(Ext.getBody());689 expect(getQueryString()).toEqual({690 foo: '1'691 });692 });693 it("should overwrite configured params", function() {694 makeButton({695 href: sencha,696 params: {697 foo: 1698 }699 });700 button.setParams({701 bar: 1702 });703 button.render(Ext.getBody());704 expect(getQueryString()).toEqual({705 bar: '1'706 });707 });708 it("should clear params", function() {709 makeButton({710 href: sencha,711 params: {712 foo: 1713 }714 });715 button.setParams(null);716 button.render(Ext.getBody());717 expect(getQueryString()).toEqual({});718 });719 });720 describe("after render", function() {721 it("should set if no params were configured", function() {722 makeButton({723 renderTo: Ext.getBody(),724 href: sencha725 });726 button.setParams({727 foo: 1728 });729 expect(getQueryString()).toEqual({730 foo: '1'731 });732 });733 it("should overwrite existing params", function() {734 makeButton({735 renderTo: Ext.getBody(),736 href: sencha,737 params: {738 foo: 1739 }740 });741 button.setParams({742 bar: 1743 });744 expect(getQueryString()).toEqual({745 bar: '1'746 });747 });748 it("should clear params", function() {749 makeButton({750 renderTo: Ext.getBody(),751 href: sencha,752 params: {753 foo: 1754 }755 });756 button.setParams(null);757 expect(getQueryString()).toEqual({});758 });759 });760 describe("with href", function() {761 it("should set params if the button href is set later", function() {762 makeButton({763 renderTo: Ext.getBody(),764 params: {765 foo: 1766 }767 });768 expect(getQueryString()).toEqual({});769 button.setHref(sencha);770 expect(getQueryString()).toEqual({771 foo: '1'772 });773 });774 it("should not set params if the url is cleared", function() {775 makeButton({776 renderTo: Ext.getBody(),777 href: sencha,778 params: {779 foo: 1780 }781 });782 button.setHref(null);783 expect(getQueryString()).toEqual({});784 });785 });786 describe("baseParams", function() {787 it("should append any baseParams to the params", function() {788 makeButton({789 renderTo: Ext.getBody(),790 href: sencha,791 params: {792 foo: 1793 },794 baseParams: {795 bar: 1796 }797 });798 expect(getQueryString()).toEqual({799 foo: '1',800 bar: '1'801 });802 });803 it("should should favour the params", function() {804 makeButton({805 renderTo: Ext.getBody(),806 href: sencha,807 params: {808 foo: 2809 },810 baseParams: {811 foo: 1812 }813 });814 expect(getQueryString()).toEqual({815 foo: '2'816 });817 });818 });819 });820 });821 describe("getActionEl", function() {822 beforeEach(function() {823 makeButton({renderTo: Ext.getBody()});824 });825 it("should return the el", function() {826 expect(button.getActionEl()).toEqual(button.el);827 });828 });829 describe("beforerender", function() {830 it("should cancel rendering if beforerender returns false", function() {831 var count = 0;832 makeButton({833 renderTo: Ext.getBody(),834 listeners: {835 beforerender: function() {836 count++;837 return false;838 },839 render: function() {840 count += 2;841 },842 afterrender: function() {843 count += 3;844 }845 }846 });847 expect(count).toBe(1);848 expect(button.el).toBeUndefined();849 expect(button.rendered).toBeFalsy();850 });851 // TODO: Add more assertions like these based on the other setters. Rather than picking at the internals it852 // would probably make sense to do assertions based on comparing the markup of two theoretically identical853 // buttons, one created directly and one that used the setters.854 it("should be possible to set the iconCls within a beforerender listener", function() {855 makeButton({856 renderTo: Ext.getBody(),857 listeners: {858 beforerender: function(btn) {859 btn.setIconCls('my-icon');860 }861 }862 });863 // Not the most precise assertion but it covers a large number of possible errors864 expect(button.el.down('.my-icon')).toBeTruthy();865 });866 it("should be possible to set the text within a beforerender listener", function() {867 makeButton({868 renderTo: Ext.getBody(),869 listeners: {870 beforerender: function(btn) {871 btn.setText('text');872 }873 }874 });875 // This is perhaps a little over specific876 expect(button.btnInnerEl.dom.innerHTML).toBe('text');877 });878 });879 describe("menu", function() {880 it("should not include menu descendant items in its CQ children if the > combinator is used", function() {881 var queryResult;882 makeButton({883 menu: [{884 text: 'Foo',885 menu: [{886 text: 'Bar',887 menu: [{888 text: 'Bletch'889 }]890 }]891 }]892 });893 // Child only query should just return the menu894 queryResult = button.query('>*');895 expect(queryResult.length).toBe(1);896 expect(queryResult[0] === button.menu).toBe(true);897 // Deep query should return the menu and its descendants.898 queryResult = button.query('*');899 // Yes. Six:900 // Top menu, its Foo item, Foo's Menu, the Bar item, Bars menu, and the Bletch item.901 expect(queryResult.length).toBe(6);902 });903 it("should accept a menu configuration", function() {904 makeButton({905 menu: {}906 });907 expect(button.menu.isMenu).toBe(true);908 });909 it("should destroy the menu on destroy", function() {910 var menu = new Ext.menu.Menu();911 makeButton({912 menu: menu913 });914 button.destroy();915 expect(menu.destroyed).toBe(true);916 menu = null;917 });918 it("should not destroy the menu with destroyMenu: false", function() {919 var menu = new Ext.menu.Menu();920 makeButton({921 destroyMenu: false,922 menu: menu923 });924 button.destroy();925 expect(menu.destroyed).toBeFalsy();926 menu.destroy();927 menu = null;928 });929 930 it("should show menu on click", function() {931 var menu;932 runs(function() {933 menu = new Ext.menu.Menu({934 shadow: false,935 items: {936 text: 'An item'937 }938 });939 makeButton({940 renderTo: Ext.getBody(),941 menu: menu942 });943 // Menu's timer before which it won't show after a hide944 menu.menuClickBuffer = 1;945 // Opening the menu with mouse does not focus it946 clickIt();947 expect(menu.isVisible()).toBe(true);948 expect(menu.containsFocus).toBeFalsy();949 // Mousedown outside the menu hides it950 clickIt("mousedown");951 expect(menu.isVisible()).toBe(false);952 clickIt('mouseup');953 });954 955 // Wait for 1ms hide timer set above to expire956 waits(5);957 // Now the menu should be willing to show again958 runs(function() {959 // Opening the menu with down arrow focuses it960 jasmine.syncPressArrowKey(button, 'down');961 expect(menu.isVisible()).toBe(true);962 });963 waitsFor(function() {964 return menu.containsFocus;965 });966 });967 it("should not show menu on click if the menu is empty", function() {968 var menu = new Ext.menu.Menu();969 makeButton({970 renderTo: Ext.getBody(),971 menu: menu972 });973 clickIt();974 expect(menu.isVisible()).toBe(false);975 });976 977 it("should show menu when showMenu is called, even if empty", function() {978 var menu = new Ext.menu.Menu({979 shadow: false980 });981 makeButton({982 renderTo: Ext.getBody(),983 menu: menu984 });985 button.showMenu();986 expect(menu.isVisible()).toBe(true);987 });988 it("should be able to access the owner during construction", function() {989 var owner;990 Ext.define('spec.SubMenu', {991 extend: 'Ext.menu.Menu',992 alias: 'widget.submenu',993 initComponent: function() {994 owner = this.getRefOwner();995 this.callParent();996 }997 });998 makeButton({999 renderTo: Ext.getBody(),1000 menu: {1001 xtype: 'submenu',1002 items: [{1003 text: 'A'1004 }]1005 }1006 });1007 expect(owner).toBe(button);1008 1009 Ext.undefine('spec.SubMenu');1010 });1011 describe("Hiding on scroll", function () {1012 // See EXTJS-14754.1013 var ctn, menu;1014 beforeEach(function () {1015 makeButton({1016 xtype: 'button',1017 text: 'Menu Button',1018 y: 300,1019 menu: {1020 items: [{1021 text: '1'1022 }, {1023 text: '2'1024 }]1025 }1026 });1027 menu = button.menu;1028 ctn = new Ext.container.Container({1029 autoScroll: true,1030 height: 400,1031 renderTo: document.body,1032 items: [button, {1033 xtype: 'label',1034 text: 'The End.',1035 y: 20001036 }]1037 });1038 clickIt();1039 });1040 1041 afterEach(function() {1042 Ext.destroy(ctn);1043 ctn = null;1044 });1045 it("should hide on scroll", function () {1046 // Let's make sure before we start that the menu is positioned correctly.1047 expect(menu.getY() - button.getHeight()).toBe(button.getY());1048 // Now, let's scroll down.1049 ctn.scrollable.scrollTo(0, 200);1050 waitsFor(function () {1051 // Scrolling should cause menu hide;1052 return menu.isVisible() === false;1053 });1054 });1055 });1056 describe("when destroying its owner", function () {1057 var menu;1058 beforeEach(function () {1059 menu = new Ext.menu.Menu();1060 makeButton({1061 menu: menu1062 });1063 button.destroy();1064 });1065 afterEach(function () {1066 menu = null;1067 });1068 it("should work", function () {1069 expect(menu.destroyed).toBe(true);1070 });1071 it("should cleanup its menu reference", function () {1072 expect(button.menu).toBe(null);1073 });1074 });1075 describe("setMenu", function() {1076 // See EXTJSIV-11433, EXTJSIV-11837.1077 var menuCfg = {1078 defaultAlign: 'c',1079 menu: {1080 items: [{1081 text: 'Level 2'1082 }]1083 }1084 },1085 menuCmp, mainMenu;1086 beforeEach(function() {1087 mainMenu = new Ext.menu.Menu({1088 id: 'lily'1089 });1090 menuCmp = new Ext.menu.Menu({1091 id: 'rupert'1092 });1093 makeButton({1094 menu: mainMenu,1095 renderTo: Ext.getBody()1096 });1097 });1098 afterEach(function() {1099 Ext.destroy(mainMenu, menuCmp);1100 mainMenu = menuCmp = null;1101 });1102 describe("setting a menu", function() {1103 it("should accept a menu component as an argument", function() {1104 button.setMenu(menuCmp);1105 expect(button.menu.isMenu).toBe(true);1106 expect(button.menu).toBe(menuCmp);1107 });1108 it("should accept a menu config as an argument", function() {1109 button.setMenu(menuCfg);1110 expect(button.getMenu().isMenu).toBe(true);1111 expect(button.getMenu().defaultAlign).toBe('c');1112 });1113 it("should accept a menu id as an argument", function() {1114 // Pass `false` to not destroy the previous set menu when setting the new one.1115 button.setMenu('rupert', false);1116 expect(button.menu).toBe(menuCmp);1117 });1118 it("should poke the split classes onto the btnWrap element when the new menu is set", function() {1119 var btn = new Ext.button.Button({1120 renderTo: Ext.getBody()1121 });1122 btn.setMenu(menuCmp);1123 expect(btn.btnWrap).toHaveCls('x-btn-arrow');1124 expect(btn.btnWrap).toHaveCls('x-btn-arrow-right');1125 btn.destroy();1126 btn = null;1127 });1128 });1129 describe("unsetting a menu", function() {1130 it("should null out the button's menu property", function() {1131 button.setMenu(null);1132 expect(button.menu).toBe(null);1133 });1134 it("should remove the split classes on the btnWrap element when the menu is unset", function() {1135 button.setMenu(null);1136 expect(button.btnWrap).not.toHaveCls('x-btn-arrow');1137 expect(button.btnWrap).not.toHaveCls('x-btn-arrow-right');1138 });1139 });1140 describe("destroying previous set menu", function() {1141 describe("when setting", function() {1142 it("should destroy the previous set menu when setting the new one by default", function() {1143 button.setMenu(menuCmp);1144 expect(mainMenu.destroyed).toBe(true);1145 });1146 it("should not destroy the previous set menu when setting the new one when passing `false`", function() {1147 button.setMenu(menuCmp, false);1148 expect(mainMenu.destroyed).toBeFalsy();1149 });1150 it("should not destroy the previous set menu when destroyMenu instance property is `false`", function() {1151 button.destroyMenu = false;1152 button.setMenu(menuCmp);1153 expect(mainMenu.destroyed).toBeFalsy();1154 });1155 });1156 describe("when unsetting", function() {1157 it("should destroy the current menu", function() {1158 button.setMenu(null);1159 expect(mainMenu.destroyed).toBe(true);1160 });1161 it("should not destroy the current menu if passed `false`", function() {1162 button.setMenu(null, false);1163 expect(mainMenu.destroyed).toBeFalsy();1164 });1165 it("should not destroy the previous set menu when destroyMenu instance property is `false`", function() {1166 button.destroyMenu = false;1167 button.setMenu(null);1168 expect(mainMenu.destroyed).toBeFalsy();1169 });1170 });1171 });1172 });1173 describe("ARIA attributes", function() {1174 var menu;1175 1176 beforeEach(function() {1177 menu = new Ext.menu.Menu({1178 items: [{1179 text: 'foo'1180 }]1181 });1182 1183 makeButton({1184 renderTo: Ext.getBody(),1185 menu: menu1186 });1187 });1188 1189 describe("aria-haspopup", function() {1190 it("should render attribute", function() {1191 expect(button).toHaveAttr('aria-haspopup', 'true');1192 });1193 1194 it("should remove attribute when menu is removed", function() {1195 button.setMenu(null);1196 1197 expect(button).not.toHaveAttr('aria-haspopup');1198 });1199 1200 it("should set attribute when menu is added", function() {1201 button.setMenu(null, false);1202 button.setMenu(menu);1203 1204 expect(button).toHaveAttr('aria-haspopup', 'true');1205 });1206 });1207 1208 describe("aria-owns", function() {1209 it("should be set to menu id", function() {1210 button.showMenu();1211 1212 expect(button).toHaveAttr('aria-owns', menu.id);1213 });1214 1215 it("should be removed when menu is removed", function() {1216 // To make sure that attribute is set1217 button.showMenu();1218 button.hideMenu();1219 1220 button.setMenu(null);1221 1222 expect(button).not.toHaveAttr('aria-owns');1223 });1224 1225 it("should be set when menu is added", function() {1226 button.setMenu(null, false);1227 button.setMenu(menu);1228 1229 expect(button).toHaveAttr('aria-owns', menu.id);1230 });1231 });1232 });1233 1234 describe("keyboard interaction", function() {1235 var enterSpy, downSpy;1236 1237 beforeEach(function() {1238 makeButton({1239 text: 'foo',1240 menu: [{1241 text: 'item1'1242 }]1243 });1244 1245 enterSpy = spyOn(button, 'onEnterKey').andCallThrough();1246 downSpy = spyOn(button, 'onDownKey').andCallThrough();1247 1248 button.render(Ext.getBody());1249 });1250 1251 afterEach(function() {1252 enterSpy = downSpy = null;1253 });1254 1255 describe("Space key", function() {1256 beforeEach(function() {1257 jasmine.pressKey(button.el, 'space');1258 1259 waitForSpy(enterSpy);1260 });1261 1262 it("should open the menu", function() {1263 expect(button.menu.isVisible()).toBe(true);1264 });1265 1266 it("should stop the keydown event", function() {1267 var args = enterSpy.mostRecentCall.args;1268 1269 expect(args[0].stopped).toBeTruthy();1270 });1271 1272 it("should return false to stop Event propagation loop", function() {1273 expect(enterSpy.mostRecentCall.result).toBe(false);1274 });1275 });1276 1277 describe("Enter key", function() {1278 beforeEach(function() {1279 jasmine.pressKey(button.el, 'enter');1280 1281 waitForSpy(enterSpy);1282 });1283 1284 it("should open the menu", function() {1285 expect(button.menu.isVisible()).toBe(true);1286 });1287 1288 it("should stop the keydown event", function() {1289 var args = enterSpy.mostRecentCall.args;1290 1291 expect(args[0].stopped).toBeTruthy();1292 });1293 1294 it("should return false to stop Event propagation loop", function() {1295 expect(enterSpy.mostRecentCall.result).toBe(false);1296 });1297 });1298 1299 describe("Down arrow key", function() {1300 beforeEach(function() {1301 jasmine.pressKey(button.el, 'down');1302 1303 waitForSpy(downSpy);1304 });1305 1306 it("should open the menu", function() {1307 expect(button.menu.isVisible()).toBe(true);1308 });1309 1310 it("should stop the keydown event", function() {1311 var args = downSpy.mostRecentCall.args;1312 1313 expect(args[0].stopped).toBeTruthy();1314 });1315 1316 it("should return false to stop Event propagation loop", function() {1317 expect(downSpy.mostRecentCall.result).toBe(false);1318 });1319 });1320 });1321 });1322 describe("tooltip", function() {1323 var QTM = Ext.tip.QuickTipManager;1324 beforeEach(function() {1325 QTM.init();1326 });1327 afterEach(function() {1328 button.destroy();1329 button = null;1330 });1331 describe("configuring", function() {1332 it("should set the qtip attribute", function() {1333 makeButton({1334 tooltip: 'Foo',1335 renderTo: Ext.getBody()1336 });1337 expect(button.el.getAttribute('data-qtip')).toBe('Foo');1338 });1339 it("should set the title attribute", function() {1340 makeButton({1341 tooltip: 'Foo',1342 tooltipType: 'title',1343 renderTo: Ext.getBody()1344 });1345 expect(button.el.getAttribute('title')).toBe('Foo');1346 });1347 it("should register with the tip manager", function() {1348 var id = Ext.id(),1349 cfg = {1350 html: 'Foo'1351 }, o;1352 spyOn(QTM, 'register').andCallFake(function(arg) {1353 o = arg;1354 });1355 makeButton({1356 id: id,1357 tooltip: cfg,1358 renderTo: Ext.getBody()1359 });1360 cfg.target = id;1361 expect(o).toEqual(cfg);1362 });1363 });1364 describe("before rendering", function() {1365 it("should set the qtip attribute", function() {1366 makeButton();1367 button.setTooltip('Foo');1368 button.render(Ext.getBody());1369 expect(button.el.getAttribute('data-qtip')).toBe('Foo');1370 });1371 it("should set the title attribute", function() {1372 makeButton({1373 tooltipType: 'title'1374 });1375 button.setTooltip('Foo');1376 button.render(Ext.getBody());1377 expect(button.el.getAttribute('title')).toBe('Foo');1378 });1379 it("should register with the tip manager", function() {1380 var id = Ext.id(),1381 cfg = {1382 html: 'Foo'1383 }, o;1384 spyOn(QTM, 'register').andCallFake(function(arg) {1385 o = arg;1386 });1387 makeButton({1388 id: id1389 });1390 cfg.target = id;1391 button.setTooltip(cfg);1392 button.render(Ext.getBody());1393 expect(o).toEqual(cfg);1394 });1395 });1396 describe("after rendering", function() {1397 describe("setting the tip", function() {1398 it("should set the qtip attribute", function() {1399 makeButton({1400 renderTo: Ext.getBody()1401 });1402 button.setTooltip('Foo');1403 expect(button.el.getAttribute('data-qtip')).toBe('Foo');1404 });1405 it("should set the title attribute", function() {1406 makeButton({1407 renderTo: Ext.getBody(),1408 tooltipType: 'title'1409 });1410 button.setTooltip('Foo');1411 expect(button.el.getAttribute('title')).toBe('Foo');1412 });1413 it("should register with the tip manager", function() {1414 var cfg = {1415 html: 'Foo'1416 }, o;1417 spyOn(QTM, 'register').andCallFake(function(arg) {1418 o = arg;1419 });1420 makeButton({1421 renderTo: Ext.getBody()1422 });1423 cfg.target = button.id;1424 button.setTooltip(cfg);1425 expect(o).toEqual(cfg);1426 });1427 });1428 describe("clearing the tip", function() {1429 it("should set the qtip attribute", function() {1430 makeButton({1431 tooltip: 'Foo',1432 renderTo: Ext.getBody()1433 });1434 button.setTooltip(null);1435 expect(button.el.getAttribute('data-qtip')).toBeFalsy();1436 });1437 it("should set the title attribute", function() {1438 makeButton({1439 tooltip: 'Foo',1440 renderTo: Ext.getBody(),1441 tooltipType: 'title'1442 });1443 button.setTooltip(null);1444 expect(button.el.getAttribute('title')).toBeFalsy();1445 });1446 it("should unregister with the tip manager", function() {1447 var cfg = {1448 html: 'Foo'1449 };1450 spyOn(QTM, 'unregister').andCallThrough();1451 makeButton({1452 tooltip: cfg,1453 renderTo: Ext.getBody()1454 });1455 button.setTooltip(null);1456 expect(QTM.unregister.mostRecentCall.args[0].id).toEqual(button.id);1457 });1458 });1459 describe("destroying", function() {1460 it("should clear the tip", function() {1461 var cfg = {1462 html: 'Foo'1463 };1464 spyOn(QTM, 'unregister').andCallThrough();1465 makeButton({1466 tooltip: cfg,1467 renderTo: Ext.getBody()1468 });1469 button.destroy();1470 expect(QTM.unregister.mostRecentCall.args[0].id).toEqual(button.id);1471 });1472 });1473 });1474 });1475 describe("handler/events", function() {1476 var spy;1477 beforeEach(function() {1478 spy = jasmine.createSpy();1479 });1480 afterEach(function() {1481 spy = null;1482 });1483 function makeEventButton(cfg) {1484 makeButton(Ext.apply({1485 renderTo: Ext.getBody()1486 }, cfg));1487 }1488 describe("click event", function() {1489 it("should fire the click event", function() {1490 makeEventButton();1491 button.on('click', spy);1492 clickIt();1493 expect(spy).toHaveBeenCalled();1494 });1495 it("should pass the button and the event object", function() {1496 makeEventButton();1497 button.on('click', spy);1498 clickIt();1499 var args = spy.mostRecentCall.args;1500 expect(args[0]).toBe(button);1501 expect(args[1] instanceof Ext.event.Event).toBe(true);1502 });1503 });1504 describe("handler", function() {1505 it("should call the handler fn", function() {1506 makeEventButton({1507 handler: spy1508 });1509 button.setHandler(spy);1510 clickIt();1511 expect(spy).toHaveBeenCalled();1512 });1513 it("should pass the button and the event object", function() {1514 makeEventButton({1515 handler: spy1516 });1517 clickIt();1518 var args = spy.mostRecentCall.args;1519 expect(args[0]).toBe(button);1520 expect(args[1] instanceof Ext.event.Event).toBe(true);1521 });1522 it("should default the scope to the button", function() {1523 makeEventButton({1524 handler: spy1525 });1526 clickIt();1527 expect(spy.mostRecentCall.object).toBe(button);1528 });1529 it("should use the passed scope", function() {1530 var scope = {};1531 makeEventButton({1532 handler: spy,1533 scope: scope1534 });1535 clickIt();1536 expect(spy.mostRecentCall.object).toBe(scope);1537 });1538 it("should be able to resolve to a View Controller", function() {1539 makeEventButton({1540 handler: 'doFoo',1541 renderTo: null1542 });1543 var ctrl = new Ext.app.ViewController();1544 ctrl.doFoo = spy;1545 var ct = new Ext.container.Container({1546 renderTo: Ext.getBody(),1547 controller: ctrl,1548 items: button1549 });1550 clickIt();1551 expect(spy).toHaveBeenCalled();1552 ct.destroy();1553 });1554 it("should not fire the handler if the click event returns false", function() {1555 makeEventButton({1556 handler: spy1557 });1558 button.on('click', function() {1559 return false;1560 });1561 clickIt();1562 expect(spy).not.toHaveBeenCalled();1563 });1564 it("should not fire the handler if the click event destroys the button", function() {1565 makeEventButton({1566 handler: spy1567 });1568 button.on('click', function() {1569 return button.destroy();1570 });1571 clickIt();1572 expect(spy).not.toHaveBeenCalled();1573 });1574 });1575 });1576 1577 describe("menuAlign config", function () {1578 var pos = 'br-tl';1579 it("should use default menuAlign if none is given", function () {1580 makeButton({1581 floating: true,1582 menu: {1583 plain: true,1584 items: [{1585 text: 'foo'1586 }, {1587 text: 'bar'1588 }]1589 }1590 });1591 expect(button.menuAlign).toBe(button.self.prototype.menuAlign);1592 });1593 it("should use menuAlign config if given", function () {1594 makeButton({1595 floating: true,1596 menuAlign: pos,1597 menu: {1598 plain: true,1599 items: [{1600 text: 'foo'1601 }, {1602 text: 'bar'1603 }]1604 },1605 renderTo: Ext.getBody()1606 });1607 expect(button.menuAlign).toBe(pos);1608 expect(button.self.prototype.menuAlign).not.toBe(pos);1609 });1610 it("should call alignTo() to position itself", function () {1611 var ctn, menu;1612 makeButton({1613 menuAlign: pos,1614 menu: {1615 plain: true,1616 items: [{1617 text: 'foo'1618 }, {1619 text: 'bar'1620 }]1621 }1622 });1623 ctn = new Ext.Container({1624 floating: true,1625 items: button,1626 renderTo: Ext.getBody()1627 });1628 menu = button.menu;1629 spyOn(menu, 'alignTo');1630 clickIt();1631 expect(menu.alignTo).toHaveBeenCalledWith(button.el, pos, undefined, false, true);1632 Ext.destroy(ctn);1633 ctn = null;1634 });1635 });1636 if (!Ext.supports.CSS3BorderRadius) {1637 // see EXTJSIV-103761638 describe("frame", function() {1639 it("should call the click listener on the wrapped table when the button is clicked", function() {1640 makeButton({1641 frame: true,1642 href: '/foo',1643 renderTo: Ext.getBody(),1644 xhooks: {1645 frameTableListener: jasmine.createSpy('frameTableListener')1646 }1647 });1648 button.frameTable.dom.click();1649 expect(button.frameTableListener).toHaveBeenCalled();1650 });1651 it("should call NOT the navigate method when a disabled button is clicked", function() {1652 // see EXTJSIV-112761653 makeButton({1654 frame: true,1655 href: '/foo',1656 disabled: true,1657 renderTo: Ext.getBody()1658 });1659 1660 spyOn(button, 'doNavigate');1661 button.frameTable.dom.click();1662 expect(button.doNavigate).not.toHaveBeenCalled();1663 });1664 it("should append any params to the url", function() {1665 spyOn(Ext.button.Button.prototype, 'getHref').andCallFake(function() {1666 return null;1667 });1668 makeButton({1669 frame: true,1670 href: '/foo',1671 renderTo: Ext.getBody()1672 });1673 1674 window.open = Ext.emptyFn;1675 button.frameTable.dom.click();1676 window.open = undefined; // IE8 :(1677 1678 expect(button.getHref).toHaveBeenCalled();1679 });1680 });1681 }1682 describe("arrowVisible", function() {1683 describe("initial value true", function() {1684 var arrowCls = 'x-btn-arrow',1685 arrowClsRight = 'x-btn-arrow-right',1686 operaArrowCls = 'x-opera12m-btn-arrow-right';1687 describe("with menu", function() {1688 it("should render with arrowCls on the buttonWrap if arrowVisible is true", function() {1689 makeButton({1690 renderTo: document.body,1691 menu: [ { text: 'fake item' }]1692 });1693 expect(button.btnWrap).toHaveCls(arrowCls);1694 expect(button.btnWrap).toHaveCls(arrowClsRight);1695 if (Ext.isOpera12m) {1696 expect(button.el).toHaveCls(operaArrowCls);1697 }1698 });1699 it("should hide and show the arrow", function() {1700 makeButton({1701 renderTo: document.body,1702 menu: [ { text: 'fake item' }]1703 });1704 button.setArrowVisible(false);1705 expect(button.btnWrap).not.toHaveCls(arrowCls);1706 expect(button.btnWrap).not.toHaveCls(arrowClsRight);1707 if (Ext.isOpera12m) {1708 expect(button.el).not.toHaveCls(operaArrowCls);1709 }1710 button.setArrowVisible(true);1711 expect(button.btnWrap).toHaveCls(arrowCls);1712 expect(button.btnWrap).toHaveCls(arrowClsRight);1713 if (Ext.isOpera12m) {1714 expect(button.el).toHaveCls(operaArrowCls);1715 }1716 });1717 it("should not render with arrowCls on the buttonWrap if arrowVisible is false", function() {1718 makeButton({1719 renderTo: document.body,1720 menu: [ { text: 'fake item' }],1721 arrowVisible: false1722 });1723 expect(button.btnWrap).not.toHaveCls(arrowCls);1724 expect(button.btnWrap).not.toHaveCls(arrowClsRight);1725 if (Ext.isOpera12m) {1726 expect(button.el).not.toHaveCls(operaArrowCls);1727 }1728 });1729 it("should remove the arrowCls if the menu is subsequently removed", function() {1730 makeButton({1731 renderTo: document.body,1732 menu: [ { text: 'fake item' }]1733 });1734 button.setMenu(null);1735 expect(button.btnWrap).not.toHaveCls(arrowCls);1736 expect(button.btnWrap).not.toHaveCls(arrowClsRight);1737 if (Ext.isOpera12m) {1738 expect(button.el).not.toHaveCls(operaArrowCls);1739 }1740 });1741 });1742 describe("without menu", function() {1743 it("should not render with arrowCls on the buttonWrap", function() {1744 makeButton({1745 renderTo: document.body1746 });1747 expect(button.btnWrap).not.toHaveCls(arrowCls);1748 expect(button.btnWrap).not.toHaveCls(arrowClsRight);1749 if (Ext.isOpera12m) {1750 expect(button.el).not.toHaveCls(operaArrowCls);1751 }1752 });1753 it("should not show the arrow", function() {1754 makeButton({1755 renderTo: document.body1756 });1757 button.setArrowVisible(true);1758 expect(button.btnWrap).not.toHaveCls(arrowCls);1759 expect(button.btnWrap).not.toHaveCls(arrowClsRight);1760 if (Ext.isOpera12m) {1761 expect(button.el).not.toHaveCls(operaArrowCls);1762 }1763 });1764 it("should add the arrowCls if a menu is subsequently added", function() {1765 makeButton({1766 renderTo: document.body1767 });1768 button.setMenu([{ text: 'fake item' }]);1769 expect(button.btnWrap).toHaveCls(arrowCls);1770 expect(button.btnWrap).toHaveCls(arrowClsRight);1771 if (Ext.isOpera12m) {1772 expect(button.el).toHaveCls(operaArrowCls);1773 }1774 });1775 it("should not add the arrowCls if a menu is subsequently added, if arrowVisible is false", function() {1776 makeButton({1777 renderTo: document.body,1778 arrowVisible: false1779 });1780 button.setMenu([{ text: 'fake item' }]);1781 expect(button.btnWrap).not.toHaveCls(arrowCls);1782 expect(button.btnWrap).not.toHaveCls(arrowClsRight);1783 if (Ext.isOpera12m) {1784 expect(button.el).not.toHaveCls(operaArrowCls);1785 }1786 });1787 });1788 });1789 });1790 describe("dynamic iconAlign", function() {1791 it("should set the iconAlign dynamically after render", function() {1792 makeButton({1793 renderTo: document.body,1794 iconCls: 'foo',1795 text: 'Icon Align'1796 });1797 var btnEl = button.btnEl,1798 btnIconEl = button.btnIconEl,1799 btnInnerEl = button.btnInnerEl;1800 expect(btnEl.first()).toBe(btnIconEl);1801 expect(btnEl.last()).toBe(btnInnerEl);1802 expect(btnEl).toHaveCls('x-btn-icon-left');1803 expect(btnEl).not.toHaveCls('x-btn-icon-top');1804 expect(btnEl).not.toHaveCls('x-btn-icon-right');1805 expect(btnEl).not.toHaveCls('x-btn-icon-bottom');1806 button.setIconAlign('right');1807 expect(btnEl.first()).toBe(btnInnerEl);1808 expect(btnEl.last()).toBe(btnIconEl);1809 expect(btnEl).toHaveCls('x-btn-icon-right');1810 expect(btnEl).not.toHaveCls('x-btn-icon-top');1811 expect(btnEl).not.toHaveCls('x-btn-icon-left');1812 expect(btnEl).not.toHaveCls('x-btn-icon-bottom');1813 button.setIconAlign('top');1814 expect(btnEl.first()).toBe(btnIconEl);1815 expect(btnEl.last()).toBe(btnInnerEl);1816 expect(btnEl).toHaveCls('x-btn-icon-top');1817 expect(btnEl).not.toHaveCls('x-btn-icon-right');1818 expect(btnEl).not.toHaveCls('x-btn-icon-left');1819 expect(btnEl).not.toHaveCls('x-btn-icon-bottom');1820 button.setIconAlign('bottom');1821 expect(btnEl.first()).toBe(btnInnerEl);1822 expect(btnEl.last()).toBe(btnIconEl);1823 expect(btnEl).toHaveCls('x-btn-icon-bottom');1824 expect(btnEl).not.toHaveCls('x-btn-icon-top');1825 expect(btnEl).not.toHaveCls('x-btn-icon-right');1826 expect(btnEl).not.toHaveCls('x-btn-icon-left');1827 button.setIconAlign('left');1828 expect(btnEl.first()).toBe(btnIconEl);1829 expect(btnEl.last()).toBe(btnInnerEl);1830 expect(btnEl).toHaveCls('x-btn-icon-left');1831 expect(btnEl).not.toHaveCls('x-btn-icon-top');1832 expect(btnEl).not.toHaveCls('x-btn-icon-right');1833 expect(btnEl).not.toHaveCls('x-btn-icon-bottom');1834 });1835 });1836 describe("layout", function() {1837 var dimensions = {1838 1: 'width',1839 2: 'height',1840 3: 'width and height'1841 };1842 1843 describe("simple tests", function() {1844 it("should be able to have a height of 0", function() {1845 expect(function() {1846 makeButton({1847 renderTo: Ext.getBody(),1848 height: 01849 });1850 }).not.toThrow(); 1851 }); 1852 1853 it("should be able to size larger after hitting a minWidth constraint", function() {1854 makeButton({1855 renderTo: Ext.getBody(),1856 minWidth: 75,1857 text: 'Foo'1858 });1859 button.setText('Text that will stretch longer than 75px');1860 expect(button.getWidth()).toBeGreaterThan(75);1861 });1862 });1863 1864 function makeLayoutSuite(shrinkWrap, stretch) {1865 var shrinkWidth = (shrinkWrap & 1),1866 shrinkHeight = (shrinkWrap & 2);1867 function makeButton(config) {1868 // Turn the icon green (specs don't need this, but helps when debugging)1869 Ext.util.CSS.createStyleSheet('.spec-icon{background-color:green;}', 'btnSpecStyleSheet');1870 button = Ext.create(Ext.apply({1871 renderTo: document.body,1872 xtype: 'button',1873 width: shrinkWidth ? null : 100,1874 height: shrinkHeight ? null : 1001875 }, config || {}));1876 }1877 function getButtonText(width, height) {1878 var style = '';1879 if (width) {1880 style += 'width:' + width + 'px;';1881 }1882 if (height) {1883 style += 'height:' + height + 'px;';1884 }1885 return '<div class="btn-text-content" style="' + style + 'display:inline-block;background:red;"> </div>';1886 }1887 // expects the icon's background-position to be 'center center'.1888 // this position should be present for all alignments of the icon element1889 function expectIconPosition() {1890 var btnIconEl = button.btnIconEl,1891 backgroundPosition;1892 if (Ext.isIE9m) {1893 expect(btnIconEl.dom.currentStyle.backgroundPositionX).toBe('center');1894 expect(btnIconEl.dom.currentStyle.backgroundPositionY).toBe('center');1895 } else {1896 backgroundPosition = btnIconEl.getStyle('background-position');1897 expect(backgroundPosition === '50% 50%' || backgroundPosition === '50%').toBe(true);1898 }1899 }1900 // since the arrow is created using an :after pseudo element its layout1901 // cannot be verified using the toHaveLayout matcher. The closest we can get1902 // is to check its computed style to ensure it has the right height, width,1903 // and display properties1904 function expectArrowStyle(props) {1905 if (!window.getComputedStyle) {1906 // IE8 will just have to do without these expectations for now.1907 return;1908 }1909 var style = window.getComputedStyle(button.btnWrap.dom, ':after'),1910 display = props.display;1911 if (Ext.isOpera12m && display === 'table-row') {1912 display = 'table-row-group';1913 }1914 if (display === 'flex') {1915 expect(style.display === 'flex' || style.display === '-ms-flexbox' || style.display === '-webkit-box').toBe(true);1916 } else {1917 expect(style.display).toBe(display);1918 }1919 if (Ext.isWebKit) {1920 // width/height check can only be done in webkit, the other browsers1921 // return 'auto' instead of a px width for the computed style of1922 // auto sized elements1923 expect(style.width).toBe(props.width);1924 expect(style.height).toBe(props.height);1925 }1926 }1927 afterEach(function() {1928 Ext.util.CSS.removeStyleSheet('btnSpecStyleSheet');1929 });1930 1931 describe((shrinkWrap ? ("shrink wrap " + dimensions[shrinkWrap] + (stretch ? ' - stretched height content' : '')) : "fixed width and height"), function() {1932 describe("no icon or arrow", function() {1933 function make(config) {1934 Ext.apply(config, {1935 text: getButtonText(1936 shrinkWidth ? 86 : 20,1937 stretch ? 94 : null1938 )1939 });1940 makeButton(config);1941 }1942 it("should layout with textAlign:left", function() {1943 make({1944 textAlign: 'left'1945 });1946 expect(button).toHaveLayout({1947 el: {1948 w: 100,1949 h: (shrinkHeight && !stretch) ? 22 : 1001950 },1951 '.btn-text-content': {1952 x: 7,1953 y: shrinkHeight ? 3 : 42,1954 w: shrinkWidth ? 86 : 20,1955 h: stretch ? 94 : 161956 }1957 });1958 });1959 it("should layout with textAlign:center", function() {1960 make({1961 textAlign: 'center'1962 });1963 expect(button).toHaveLayout({1964 el: {1965 w: 100,1966 h: (shrinkHeight && !stretch) ? 22 : 1001967 },1968 '.btn-text-content': {1969 x: shrinkWidth ? 7 : 40,1970 y: shrinkHeight ? 3 : 42,1971 w: shrinkWidth ? 86 : 20,1972 h: stretch ? 94 : 161973 }1974 });1975 });1976 it("should layout with textAlign:right", function() {1977 make({1978 textAlign: 'right'1979 });1980 expect(button).toHaveLayout({1981 el: {1982 w: 100,1983 h: (shrinkHeight && !stretch) ? 22 : 1001984 },1985 '.btn-text-content': {1986 x: shrinkWidth ? 7 : 73,1987 y: shrinkHeight ? 3 : 42,1988 w: shrinkWidth ? 86 : 20,1989 h: stretch ? 94 : 161990 }1991 });1992 });1993 });1994 describe("with icon", function() {1995 function make(config) {1996 var iconVertical = (config.iconAlign === 'top' || config.iconAlign === 'bottom');1997 makeButton(Ext.apply({1998 iconCls: 'spec-icon',1999 text: getButtonText(2000 shrinkWidth ? (iconVertical ? 86 : 70) : 20,2001 stretch ? (iconVertical ? 74 : 94) : null2002 )2003 }, config));2004 }2005 describe("iconAlign:top", function() {2006 it("no text", function() {2007 make({2008 text: '',2009 iconAlign: 'top'2010 });2011 expect(button).toHaveLayout({2012 el: {2013 w: shrinkWidth ? 22 : 100,2014 h: shrinkHeight? 22 : 1002015 },2016 btnIconEl: {2017 x: 3,2018 y: shrinkHeight ? 3 : 42,2019 w: shrinkWidth ? 16 : 94,2020 h: 162021 }2022 });2023 expectIconPosition();2024 });2025 it("textAlign:left", function() {2026 make({2027 textAlign: 'left',2028 iconAlign: 'top'2029 });2030 expect(button).toHaveLayout({2031 el: {2032 w: 100,2033 h: (shrinkHeight && !stretch) ? 42 : 1002034 },2035 btnIconEl: {2036 x: 3,2037 y: shrinkHeight ? 3 : 32,2038 w: 94,2039 h: 162040 },2041 '.btn-text-content': {2042 x: 7,2043 y: shrinkHeight ? 23 : 52,2044 w: shrinkWidth ? 86 : 20,2045 h: stretch ? 74 : 162046 }2047 });2048 expectIconPosition();2049 });2050 it("textAlign:center", function() {2051 make({2052 textAlign: 'center',2053 iconAlign: 'top'2054 });2055 expect(button).toHaveLayout({2056 el: {2057 w: 100,2058 h: (shrinkHeight && !stretch) ? 42 : 1002059 },2060 btnIconEl: {2061 x: 3,2062 y: shrinkHeight ? 3 : 32,2063 w: 94,2064 h: 162065 },2066 '.btn-text-content': {2067 x: shrinkWidth ? 7 : 40,2068 y: shrinkHeight ? 23 : 52,2069 w: shrinkWidth ? 86 : 20,2070 h: stretch ? 74 : 162071 }2072 });2073 expectIconPosition();2074 });2075 it("textAlign:right", function() {2076 make({2077 textAlign: 'right',2078 iconAlign: 'top'2079 });2080 expect(button).toHaveLayout({2081 el: {2082 w: 100,2083 h: (shrinkHeight && !stretch) ? 42 : 1002084 },2085 btnIconEl: {2086 x: 3,2087 y: shrinkHeight ? 3 : 32,2088 w: 94,2089 h: 162090 },2091 '.btn-text-content': {2092 x: shrinkWidth ? 7 : 73,2093 y: shrinkHeight ? 23 : 52,2094 w: shrinkWidth ? 86 : 20,2095 h: stretch ? 74 : 162096 }2097 });2098 expectIconPosition();2099 });2100 });2101 describe("iconAlign:right", function() {2102 it("no text", function() {2103 make({2104 text: '',2105 iconAlign: 'right'2106 });2107 expect(button).toHaveLayout({2108 el: {2109 w: shrinkWidth ? 22 : 100,2110 h: shrinkHeight? 22 : 1002111 },2112 btnIconEl: {2113 x: shrinkWidth ? 3 : 42,2114 y: shrinkHeight ? 3 : 42,2115 w: 16,2116 h: 162117 }2118 });2119 expectIconPosition();2120 });2121 it("textAlign:left", function() {2122 make({2123 textAlign: 'left',2124 iconAlign: 'right'2125 });2126 expect(button).toHaveLayout({2127 el: {2128 w: 100,2129 h: (shrinkHeight && !stretch) ? 22 : 1002130 },2131 btnIconEl: {2132 x: shrinkWidth ? 81 : 31,2133 y: (shrinkHeight && !stretch) ? 3 : 42,2134 w: 16,2135 h: 162136 },2137 '.btn-text-content': {2138 x: 7,2139 y: shrinkHeight ? 3 : 42,2140 w: shrinkWidth ? 70 : 20,2141 h: stretch ? 94 : 162142 }2143 });2144 expectIconPosition();2145 });2146 it("textAlign:center", function() {2147 make({2148 textAlign: 'center',2149 iconAlign: 'right'2150 });2151 expect(button).toHaveLayout({2152 el: {2153 w: 100,2154 h: (shrinkHeight && !stretch) ? 22 : 1002155 },2156 btnIconEl: {2157 x: shrinkWidth ? 81 : 56,2158 y: (shrinkHeight && !stretch) ? 3 : 42,2159 w: 16,2160 h: 162161 },2162 '.btn-text-content': {2163 x: shrinkWidth ? 7 : 32,2164 y: shrinkHeight ? 3 : 42,2165 w: shrinkWidth ? 70 : 20,2166 h: stretch ? 94 : 162167 }2168 });2169 expectIconPosition();2170 });2171 it("textAlign:right", function() {2172 make({2173 textAlign: 'right',2174 iconAlign: 'right'2175 });2176 expect(button).toHaveLayout({2177 el: {2178 w: 100,2179 h: (shrinkHeight && !stretch) ? 22 : 1002180 },2181 btnIconEl: {2182 x: 81,2183 y: (shrinkHeight && !stretch) ? 3 : 42,2184 w: 16,2185 h: 162186 },2187 '.btn-text-content': {2188 x: shrinkWidth ? 7 : 57,2189 y: shrinkHeight ? 3 : 42,2190 w: shrinkWidth ? 70 : 20,2191 h: stretch ? 94 : 162192 }2193 });2194 expectIconPosition();2195 });2196 });2197 describe("iconAlign:bottom", function() {2198 it("no text", function() {2199 make({2200 text: '',2201 iconAlign: 'bottom'2202 });2203 expect(button).toHaveLayout({2204 el: {2205 w: shrinkWidth ? 22 : 100,2206 h: shrinkHeight? 22 : 1002207 },2208 btnIconEl: {2209 x: 3,2210 y: shrinkHeight ? 3 : 42,2211 w: shrinkWidth ? 16 : 94,2212 h: 162213 }2214 });2215 expectIconPosition();2216 });2217 it("textAlign:left", function() {2218 make({2219 textAlign: 'left',2220 iconAlign: 'bottom'2221 });2222 expect(button).toHaveLayout({2223 el: {2224 w: 100,2225 h: (shrinkHeight && !stretch) ? 42 : 1002226 },2227 btnIconEl: {2228 x: 3,2229 y: shrinkHeight ? (stretch ? 81 : 23) : 52,2230 w: 94,2231 h: 162232 },2233 '.btn-text-content': {2234 x: 7,2235 y: shrinkHeight ? 3 : 32,2236 w: shrinkWidth ? 86 : 20,2237 h: stretch ? 74 : 162238 }2239 });2240 expectIconPosition();2241 });2242 it("textAlign:center", function() {2243 make({2244 textAlign: 'center',2245 iconAlign: 'bottom'2246 });2247 expect(button).toHaveLayout({2248 el: {2249 w: 100,2250 h: (shrinkHeight && !stretch) ? 42 : 1002251 },2252 btnIconEl: {2253 x: 3,2254 y: shrinkHeight ? (stretch ? 81 : 23) : 52,2255 w: 94,2256 h: 162257 },2258 '.btn-text-content': {2259 x: shrinkWidth ? 7 : 40,2260 y: shrinkHeight ? 3 : 32,2261 w: shrinkWidth ? 86 : 20,2262 h: stretch ? 74 : 162263 }2264 });2265 expectIconPosition();2266 });2267 it("textAlign:right", function() {2268 make({2269 textAlign: 'right',2270 iconAlign: 'bottom'2271 });2272 expect(button).toHaveLayout({2273 el: {2274 w: 100,2275 h: (shrinkHeight && !stretch) ? 42 : 1002276 },2277 btnIconEl: {2278 x: 3,2279 y: shrinkHeight ? (stretch ? 81 : 23) : 52,2280 w: 94,2281 h: 162282 },2283 '.btn-text-content': {2284 x: shrinkWidth ? 7 : 73,2285 y: shrinkHeight ? 3 : 32,2286 w: shrinkWidth ? 86 : 20,2287 h: stretch ? 74 : 162288 }2289 });2290 expectIconPosition();2291 });2292 });2293 describe("iconAlign:left", function() {2294 it("no text", function() {2295 make({2296 text: '',2297 iconAlign: 'left'2298 });2299 expect(button).toHaveLayout({2300 el: {2301 w: shrinkWidth ? 22 : 100,2302 h: shrinkHeight? 22 : 1002303 },2304 btnIconEl: {2305 x: shrinkWidth ? 3 : 42,2306 y: shrinkHeight ? 3 : 42,2307 w: 16,2308 h: 162309 }2310 });2311 2312 expectIconPosition();2313 });2314 it("textAlign:left", function() {2315 make({2316 textAlign: 'left',2317 iconAlign: 'left'2318 });2319 expect(button).toHaveLayout({2320 el: {2321 w: 100,2322 h: (shrinkHeight && !stretch) ? 22 : 1002323 },2324 btnIconEl: {2325 x: 3,2326 y: (shrinkHeight && !stretch) ? 3 : 42,2327 w: 16,2328 h: 162329 },2330 '.btn-text-content': {2331 x: 23,2332 y: shrinkHeight ? 3 : 42,2333 w: shrinkWidth ? 70 : 20,2334 h: stretch ? 94 : 162335 }2336 });2337 expectIconPosition();2338 });2339 it("textAlign:center", function() {2340 make({2341 textAlign: 'center',2342 iconAlign: 'left'2343 });2344 expect(button).toHaveLayout({2345 el: {2346 w: 100,2347 h: (shrinkHeight && !stretch) ? 22 : 1002348 },2349 btnIconEl: {2350 x: shrinkWidth ? 3 : 28,2351 y: (shrinkHeight && !stretch) ? 3 : 42,2352 w: 16,2353 h: 162354 },2355 '.btn-text-content': {2356 x: shrinkWidth ? 23 : 48,2357 y: shrinkHeight ? 3 : 42,2358 w: shrinkWidth ? 70 : 20,2359 h: stretch ? 94 : 162360 }2361 });2362 expectIconPosition();2363 });2364 it("textAlign:right", function() {2365 make({2366 textAlign: 'right',2367 iconAlign: 'left'2368 });2369 expect(button).toHaveLayout({2370 el: {2371 w: 100,2372 h: (shrinkHeight && !stretch) ? 22 : 1002373 },2374 btnIconEl: {2375 x: shrinkWidth ? 3 : 53,2376 y: (shrinkHeight && !stretch) ? 3 : 42,2377 w: 16,2378 h: 162379 },2380 '.btn-text-content': {2381 x: shrinkWidth ? 23 : 73,2382 y: shrinkHeight ? 3 : 42,2383 w: shrinkWidth ? 70 : 20,2384 h: stretch ? 94 : 162385 }2386 });2387 expectIconPosition();2388 });2389 });2390 });2391 describe("with arrow", function() {2392 function make(config) {2393 makeButton(Ext.apply({2394 menu: [],2395 text: getButtonText(2396 shrinkWidth ? (config.arrowAlign === 'bottom' ? 86 : 78) : 20,2397 stretch ? (config.arrowAlign === 'bottom' ? 84 : 94) : null2398 )2399 }, config));2400 }2401 describe("arrowAlign:right", function() {2402 it("textAlign:left", function() {2403 make({2404 arrowAlign: 'right',2405 textAlign: 'left'2406 });2407 expect(button).toHaveLayout({2408 el: {2409 w: 100,2410 h: (shrinkHeight && !stretch) ? 22 : 1002411 },2412 '.btn-text-content': {2413 x: 7,2414 y: shrinkHeight ? 3 : 42,2415 w: shrinkWidth ? 78 : 20,2416 h: stretch ? 94 : 162417 }2418 });2419 expectArrowStyle({2420 display: Ext.isIE9m ? 'table-cell' : 'flex',2421 width: '8px',2422 height: (shrinkHeight && !stretch) ? '16px' : '94px'2423 });2424 });2425 it("textAlign:center", function() {2426 make({2427 arrowAlign: 'right',2428 textAlign: 'center'2429 });2430 expect(button).toHaveLayout({2431 el: {2432 w: 100,2433 h: (shrinkHeight && !stretch) ? 22 : 1002434 },2435 '.btn-text-content': {2436 x: shrinkWidth ? 7 : 36,2437 y: shrinkHeight ? 3 : 42,2438 w: shrinkWidth ? 78 : 20,2439 h: stretch ? 94 : 162440 }2441 });2442 expectArrowStyle({2443 display: Ext.isIE9m ? 'table-cell' : 'flex',2444 width: '8px',2445 height: (shrinkHeight && !stretch) ? '16px' : '94px'2446 });2447 });2448 it("textAlign:right", function() {2449 make({2450 arrowAlign: 'right',2451 textAlign: 'right'2452 });2453 expect(button).toHaveLayout({2454 el: {2455 w: 100,2456 h: (shrinkHeight && !stretch) ? 22 : 1002457 },2458 '.btn-text-content': {2459 x: shrinkWidth ? 7 : 65,2460 y: shrinkHeight ? 3 : 42,2461 w: shrinkWidth ? 78 : 20,2462 h: stretch ? 94 : 162463 }2464 });2465 expectArrowStyle({2466 display: Ext.isIE9m ? 'table-cell' : 'flex',2467 width: '8px',2468 height: (shrinkHeight && !stretch) ? '16px' : '94px'2469 });2470 });2471 });2472 describe("arrowAlign:bottom", function() {2473 it("textAlign:left", function() {2474 make({2475 arrowAlign: 'bottom',2476 textAlign: 'left'2477 });2478 expect(button).toHaveLayout({2479 el: {2480 w: 100,2481 h: (shrinkHeight && !stretch) ? 32 : 1002482 },2483 '.btn-text-content': {2484 x: 7,2485 y: shrinkHeight ? 3 : 37,2486 w: shrinkWidth ? 86 : 20,2487 h: stretch ? 84 : 162488 }2489 });2490 expectArrowStyle({2491 display: Ext.isIE9m ? 'table-row' : 'block',2492 width: '94px',2493 height: '8px'2494 });2495 });2496 it("textAlign:center", function() {2497 make({2498 arrowAlign: 'bottom',2499 textAlign: 'center'2500 });2501 expect(button).toHaveLayout({2502 el: {2503 w: 100,2504 h: (shrinkHeight && !stretch) ? 32 : 1002505 },2506 '.btn-text-content': {2507 x: shrinkWidth ? 7 : 40,2508 y: shrinkHeight ? 3 : 37,2509 w: shrinkWidth ? 86 : 20,2510 h: stretch ? 84 : 162511 }2512 });2513 expectArrowStyle({2514 display: Ext.isIE9m ? 'table-row' : 'block',2515 width: '94px',2516 height: '8px'2517 });2518 });2519 it("textAlign:right", function() {2520 make({2521 arrowAlign: 'bottom',2522 textAlign: 'right'2523 });2524 expect(button).toHaveLayout({2525 el: {2526 w: 100,2527 h: (shrinkHeight && !stretch) ? 32 : 1002528 },2529 '.btn-text-content': {2530 x: shrinkWidth ? 7 : 73,2531 y: shrinkHeight ? 3 : 37,2532 w: shrinkWidth ? 86 : 20,2533 h: stretch ? 84 : 162534 }2535 });2536 expectArrowStyle({2537 display: Ext.isIE9m ? 'table-row' : 'block',2538 width: '94px',2539 height: '8px'2540 });2541 });2542 });2543 });2544 describe("with split arrow", function() {2545 function make(config) {2546 makeButton(Ext.apply({2547 xtype: 'splitbutton',2548 text: getButtonText(2549 shrinkWidth ? (config.arrowAlign === 'bottom' ? 86 : 72) : 20,2550 stretch ? (config.arrowAlign === 'bottom' ? 78 : 94) : null2551 )2552 }, config));2553 }2554 describe("arrowAlign:right", function() {2555 it("textAlign:left", function() {2556 make({2557 arrowAlign: 'right',2558 textAlign: 'left'2559 });2560 expect(button).toHaveLayout({2561 el: {2562 w: 100,2563 h: (shrinkHeight && !stretch) ? 22 : 1002564 },2565 '.btn-text-content': {2566 x: 7,2567 y: shrinkHeight ? 3 : 42,2568 w: shrinkWidth ? 72 : 20,2569 h: stretch ? 94 : 162570 }2571 });2572 expectArrowStyle({2573 display: Ext.isIE9m ? 'table-cell' : 'flex',2574 width: '14px',2575 height: (shrinkHeight && !stretch) ? '16px' : '94px'2576 });2577 });2578 it("textAlign:center", function() {2579 make({2580 arrowAlign: 'right',2581 textAlign: 'center'2582 });2583 expect(button).toHaveLayout({2584 el: {2585 w: 100,2586 h: (shrinkHeight && !stretch) ? 22 : 1002587 },2588 '.btn-text-content': {2589 x: shrinkWidth ? 7 : 33,2590 y: shrinkHeight ? 3 : 42,2591 w: shrinkWidth ? 72 : 20,2592 h: stretch ? 94 : 162593 }2594 });2595 expectArrowStyle({2596 display: Ext.isIE9m ? 'table-cell' : 'flex',2597 width: '14px',2598 height: (shrinkHeight && !stretch) ? '16px' : '94px'2599 });2600 });2601 it("textAlign:right", function() {2602 make({2603 arrowAlign: 'right',2604 textAlign: 'right'2605 });2606 expect(button).toHaveLayout({2607 el: {2608 w: 100,2609 h: (shrinkHeight && !stretch) ? 22 : 1002610 },2611 '.btn-text-content': {2612 x: shrinkWidth ? 7 : 59,2613 y: shrinkHeight ? 3 : 42,2614 w: shrinkWidth ? 72 : 20,2615 h: stretch ? 94 : 162616 }2617 });2618 expectArrowStyle({2619 display: Ext.isIE9m ? 'table-cell' : 'flex',2620 width: '14px',2621 height: (shrinkHeight && !stretch) ? '16px' : '94px'2622 });2623 });2624 });2625 describe("arrowAlign:bottom", function() {2626 it("textAlign:left", function() {2627 make({2628 arrowAlign: 'bottom',2629 textAlign: 'left'2630 });2631 expect(button).toHaveLayout({2632 el: {2633 w: 100,2634 h: (shrinkHeight && !stretch) ? 38 : 1002635 },2636 '.btn-text-content': {2637 x: 7,2638 y: shrinkHeight ? 3 : 34,2639 w: shrinkWidth ? 86 : 20,2640 h: stretch ? 78 : 162641 }2642 });2643 expectArrowStyle({2644 display: Ext.isIE9m ? 'table-row' : 'block',2645 width: '94px',2646 height: '14px'2647 });2648 });2649 it("textAlign:center", function() {2650 make({2651 arrowAlign: 'bottom',2652 textAlign: 'center'2653 });2654 expect(button).toHaveLayout({2655 el: {2656 w: 100,2657 h: (shrinkHeight && !stretch) ? 38 : 1002658 },2659 '.btn-text-content': {2660 x: shrinkWidth ? 7 : 40,2661 y: shrinkHeight ? 3 : 34,2662 w: shrinkWidth ? 86 : 20,2663 h: stretch ? 78 : 162664 }2665 });2666 expectArrowStyle({2667 display: Ext.isIE9m ? 'table-row' : 'block',2668 width: '94px',2669 height: '14px'2670 });2671 });2672 it("textAlign:right", function() {2673 make({2674 arrowAlign: 'bottom',2675 textAlign: 'right'2676 });2677 expect(button).toHaveLayout({2678 el: {2679 w: 100,2680 h: (shrinkHeight && !stretch) ? 38 : 1002681 },2682 '.btn-text-content': {2683 x: shrinkWidth ? 7 : 73,2684 y: shrinkHeight ? 3 : 34,2685 w: shrinkWidth ? 86 : 20,2686 h: stretch ? 78 : 162687 }2688 });2689 expectArrowStyle({2690 display: Ext.isIE9m ? 'table-row' : 'block',2691 width: '94px',2692 height: '14px'2693 });2694 });2695 });2696 });2697 describe("with icon and arrow", function() {2698 function make(config) {2699 var iconAlign = config.iconAlign,2700 bottomArrow = config.arrowAlign === 'bottom',2701 textWidth,2702 textHeight;2703 if (iconAlign === 'top' || iconAlign === 'bottom') {2704 textWidth = bottomArrow ? 86 : 78;2705 textHeight = bottomArrow ? 64 : 74;2706 } else if (iconAlign === 'right') {2707 textWidth = bottomArrow ? 70 : 58;2708 textHeight = bottomArrow ? 84 : 94;2709 } else if (iconAlign === 'left') {2710 textWidth = bottomArrow ? 70 : 62;2711 textHeight = bottomArrow ? 84 : 94;2712 }2713 makeButton(Ext.apply({2714 iconCls: 'spec-icon',2715 menu: [],2716 text: getButtonText(2717 shrinkWidth ? textWidth : 20,2718 stretch ? textHeight : null2719 )2720 }, config));2721 }2722 describe("iconAlign:top", function() {2723 describe("arrowAlign:right", function() {2724 it("no text", function() {2725 make({2726 iconAlign: 'top',2727 arrowAlign: 'right',2728 text: ''2729 });2730 expect(button).toHaveLayout({2731 el: {2732 w: shrinkWidth ? 34 : 100,2733 h: shrinkHeight? 22 : 1002734 },2735 btnIconEl: {2736 x: 3,2737 y: shrinkHeight ? 3 : 42,2738 w: shrinkWidth ? 16 : 82,2739 h: 162740 }2741 });2742 expectIconPosition();2743 expectArrowStyle({2744 display: Ext.isIE9m ? 'table-cell' : 'flex',2745 width: '8px',2746 height: shrinkHeight ? '16px' : '94px'2747 });2748 });2749 it("textAlign:left", function() {2750 make({2751 iconAlign: 'top',2752 arrowAlign: 'right',2753 textAlign: 'left'2754 });2755 expect(button).toHaveLayout({2756 el: {2757 w: 100,2758 h: (shrinkHeight && !stretch) ? 42 : 1002759 },2760 btnIconEl: {2761 x: 3,2762 y: shrinkHeight ? 3 : 32,2763 w: 86,2764 h: 162765 },2766 '.btn-text-content': {2767 x: 7,2768 y: shrinkHeight ? 23 : 52,2769 w: shrinkWidth ? 78 : 20,2770 h: stretch ? 74 : 162771 }2772 });2773 expectIconPosition();2774 expectArrowStyle({2775 display: Ext.isIE9m ? 'table-cell' : 'flex',2776 width: '8px',2777 height: (shrinkHeight && !stretch) ? '36px' : '94px'2778 });2779 });2780 it("textAlign:center", function() {2781 make({2782 iconAlign: 'top',2783 arrowAlign: 'right',2784 textAlign: 'center'2785 });2786 expect(button).toHaveLayout({2787 el: {2788 w: 100,2789 h: (shrinkHeight && !stretch) ? 42 : 1002790 },2791 btnIconEl: {2792 x: 3,2793 y: shrinkHeight ? 3 : 32,2794 w: 86,2795 h: 162796 },2797 '.btn-text-content': {2798 x: shrinkWidth ? 7 : 36,2799 y: shrinkHeight ? 23 : 52,2800 w: shrinkWidth ? 78 : 20,2801 h: stretch ? 74 : 162802 }2803 });2804 expectIconPosition();2805 expectArrowStyle({2806 display: Ext.isIE9m ? 'table-cell' : 'flex',2807 width: '8px',2808 height: (shrinkHeight && !stretch) ? '36px' : '94px'2809 });2810 });2811 it("textAlign:right", function() {2812 make({2813 iconAlign: 'top',2814 arrowAlign: 'right',2815 textAlign: 'right'2816 });2817 expect(button).toHaveLayout({2818 el: {2819 w: 100,2820 h: (shrinkHeight && !stretch) ? 42 : 1002821 },2822 btnIconEl: {2823 x: 3,2824 y: shrinkHeight ? 3 : 32,2825 w: 86,2826 h: 162827 },2828 '.btn-text-content': {2829 x: shrinkWidth ? 7 : 65,2830 y: shrinkHeight ? 23 : 52,2831 w: shrinkWidth ? 78 : 20,2832 h: stretch ? 74 : 162833 }2834 });2835 expectIconPosition();2836 expectArrowStyle({2837 display: Ext.isIE9m ? 'table-cell' : 'flex',2838 width: '8px',2839 height: (shrinkHeight && !stretch) ? '36px' : '94px'2840 });2841 });2842 });2843 describe("arrowAlign:bottom", function() {2844 it("no text", function() {2845 make({2846 iconAlign: 'top',2847 arrowAlign: 'bottom',2848 text: ''2849 });2850 expect(button).toHaveLayout({2851 el: {2852 w: shrinkWidth ? 22 : 100,2853 h: shrinkHeight? 32 : 1002854 },2855 btnIconEl: {2856 x: 3,2857 y: shrinkHeight ? 3 : 37,2858 w: shrinkWidth ? 16 : 94,2859 h: 162860 }2861 });2862 expectIconPosition();2863 expectArrowStyle({2864 display: Ext.isIE9m ? 'table-row' : 'block',2865 width: shrinkWidth ? '16px' : '94px',2866 height: '8px'2867 });2868 });2869 it("textAlign:left", function() {2870 make({2871 iconAlign: 'top',2872 arrowAlign: 'bottom',2873 textAlign: 'left'2874 });2875 expect(button).toHaveLayout({2876 el: {2877 w: 100,2878 h: (shrinkHeight && !stretch) ? 52 : 1002879 },2880 btnIconEl: {2881 x: 3,2882 y: shrinkHeight ? 3 : 27,2883 w: 94,2884 h: 162885 },2886 '.btn-text-content': {2887 x: 7,2888 y: shrinkHeight ? 23 : 47,2889 w: shrinkWidth ? 86 : 20,2890 h: stretch ? 64 : 162891 }2892 });2893 expectIconPosition();2894 expectArrowStyle({2895 display: Ext.isIE9m ? 'table-row' : 'block',2896 width: '94px',2897 height: '8px'2898 });2899 });2900 it("textAlign:center", function() {2901 make({2902 iconAlign: 'top',2903 arrowAlign: 'bottom',2904 textAlign: 'center'2905 });2906 expect(button).toHaveLayout({2907 el: {2908 w: 100,2909 h: (shrinkHeight && !stretch) ? 52 : 1002910 },2911 btnIconEl: {2912 x: 3,2913 y: shrinkHeight ? 3 : 27,2914 w: 94,2915 h: 162916 },2917 '.btn-text-content': {2918 x: shrinkWidth ? 7 : 40,2919 y: shrinkHeight ? 23 : 47,2920 w: shrinkWidth ? 86 : 20,2921 h: stretch ? 64 : 162922 }2923 });2924 expectIconPosition();2925 expectArrowStyle({2926 display: Ext.isIE9m ? 'table-row' : 'block',2927 width: '94px',2928 height: '8px'2929 });2930 });2931 it("textAlign:right", function() {2932 make({2933 iconAlign: 'top',2934 arrowAlign: 'bottom',2935 textAlign: 'right'2936 });2937 expect(button).toHaveLayout({2938 el: {2939 w: 100,2940 h: (shrinkHeight && !stretch) ? 52 : 1002941 },2942 btnIconEl: {2943 x: 3,2944 y: shrinkHeight ? 3 : 27,2945 w: 94,2946 h: 162947 },2948 '.btn-text-content': {2949 x: shrinkWidth ? 7 : 73,2950 y: shrinkHeight ? 23 : 47,2951 w: shrinkWidth ? 86 : 20,2952 h: stretch ? 64 : 162953 }2954 });2955 expectIconPosition();2956 expectArrowStyle({2957 display: Ext.isIE9m ? 'table-row' : 'block',2958 width: '94px',2959 height: '8px'2960 });2961 });2962 });2963 });2964 describe("iconAlign:right", function() {2965 describe("arrowAlign:right", function() {2966 it("no text", function() {2967 make({2968 iconAlign: 'right',2969 arrowAlign: 'right',2970 text: ''2971 });2972 expect(button).toHaveLayout({2973 el: {2974 w: shrinkWidth ? 34 : 100,2975 h: shrinkHeight? 22 : 1002976 },2977 btnIconEl: {2978 x: shrinkWidth ? 3 : 36,2979 y: shrinkHeight ? 3 : 42,2980 w: 16,2981 h: 162982 }2983 });2984 expectIconPosition();2985 expectArrowStyle({2986 display: Ext.isIE9m ? 'table-cell' : 'flex',2987 width: '8px',2988 height: shrinkHeight ? '16px' : '94px'2989 });2990 });2991 it("textAlign:left", function() {2992 make({2993 iconAlign: 'right',2994 arrowAlign: 'right',2995 textAlign: 'left'2996 });2997 expect(button).toHaveLayout({2998 el: {2999 w: 100,3000 h: (shrinkHeight && !stretch) ? 22 : 1003001 },3002 btnIconEl: {3003 x: shrinkWidth ? 69 : 31,3004 y: (shrinkHeight && !stretch) ? 3 : 42,3005 w: 16,3006 h: 163007 },3008 '.btn-text-content': {3009 x: 7,3010 y: shrinkHeight ? 3 : 42,3011 w: shrinkWidth ? 58 : 20,3012 h: stretch ? 94 : 163013 }3014 });3015 expectIconPosition();3016 expectArrowStyle({3017 display: Ext.isIE9m ? 'table-cell' : 'flex',3018 width: '8px',3019 height: (shrinkHeight && !stretch) ? '16px' : '94px'3020 });3021 });3022 it("textAlign:center", function() {3023 make({3024 iconAlign: 'right',3025 arrowAlign: 'right',3026 textAlign: 'center'3027 });3028 expect(button).toHaveLayout({3029 el: {3030 w: 100,3031 h: (shrinkHeight && !stretch) ? 22 : 1003032 },3033 btnIconEl: {3034 x: shrinkWidth ? 69 : 50,3035 y: (shrinkHeight && !stretch) ? 3 : 42,3036 w: 16,3037 h: 163038 },3039 '.btn-text-content': {3040 x: shrinkWidth ? 7 : 26,3041 y: shrinkHeight ? 3 : 42,3042 w: shrinkWidth ? 58 : 20,3043 h: stretch ? 94 : 163044 }3045 });3046 expectIconPosition();3047 expectArrowStyle({3048 display: Ext.isIE9m ? 'table-cell' : 'flex',3049 width: '8px',3050 height: (shrinkHeight && !stretch) ? '16px' : '94px'3051 });3052 });3053 it("textAlign:right", function() {3054 make({3055 iconAlign: 'right',3056 arrowAlign: 'right',3057 textAlign: 'right'3058 });3059 expect(button).toHaveLayout({3060 el: {3061 w: 100,3062 h: (shrinkHeight && !stretch) ? 22 : 1003063 },3064 btnIconEl: {3065 x: 69,3066 y: (shrinkHeight && !stretch) ? 3 : 42,3067 w: 16,3068 h: 163069 },3070 '.btn-text-content': {3071 x: shrinkWidth ? 7 : 45,3072 y: shrinkHeight ? 3 : 42,3073 w: shrinkWidth ? 58 : 20,3074 h: stretch ? 94 : 163075 }3076 });3077 expectIconPosition();3078 expectArrowStyle({3079 display: Ext.isIE9m ? 'table-cell' : 'flex',3080 width: '8px',3081 height: (shrinkHeight && !stretch) ? '16px' : '94px'3082 });3083 });3084 });3085 describe("arrowAlign:bottom", function() {3086 it("no text", function() {3087 make({3088 iconAlign: 'right',3089 arrowAlign: 'bottom',3090 text: ''3091 });3092 expect(button).toHaveLayout({3093 el: {3094 w: shrinkWidth ? 22 : 100,3095 h: shrinkHeight? 32 : 1003096 },3097 btnIconEl: {3098 x: shrinkWidth ? 3 : 42,3099 y: shrinkHeight ? 3 : 37,3100 w: 16,3101 h: 163102 }3103 });3104 expectIconPosition();3105 expectArrowStyle({3106 display: Ext.isIE9m ? 'table-row' : 'block',3107 width: shrinkWidth ? '16px' : '94px',3108 height: '8px'3109 });3110 });3111 it("textAlign:left", function() {3112 make({3113 iconAlign: 'right',3114 arrowAlign: 'bottom',3115 textAlign: 'left'3116 });3117 expect(button).toHaveLayout({3118 el: {3119 w: 100,3120 h: (shrinkHeight && !stretch) ? 32 : 1003121 },3122 btnIconEl: {3123 x: shrinkWidth ? 81 : 31,3124 y: (shrinkHeight && !stretch) ? 3 : 37,3125 w: 16,3126 h: 163127 },3128 '.btn-text-content': {3129 x: 7,3130 y: shrinkHeight ? 3 : 37,3131 w: shrinkWidth ? 70 : 20,3132 h: stretch ? 84 : 163133 }3134 });3135 expectIconPosition();3136 expectArrowStyle({3137 display: Ext.isIE9m ? 'table-row' : 'block',3138 width: '94px',3139 height: '8px'3140 });3141 });3142 it("textAlign:center", function() {3143 make({3144 iconAlign: 'right',3145 arrowAlign: 'bottom',3146 textAlign: 'center'3147 });3148 expect(button).toHaveLayout({3149 el: {3150 w: 100,3151 h: (shrinkHeight && !stretch) ? 32 : 1003152 },3153 btnIconEl: {3154 x: shrinkWidth ? 81 : 56,3155 y: (shrinkHeight && !stretch) ? 3 : 37,3156 w: 16,3157 h: 163158 },3159 '.btn-text-content': {3160 x: shrinkWidth ? 7 : 32,3161 y: shrinkHeight ? 3 : 37,3162 w: shrinkWidth ? 70 : 20,3163 h: stretch ? 84 : 163164 }3165 });3166 expectIconPosition();3167 expectArrowStyle({3168 display: Ext.isIE9m ? 'table-row' : 'block',3169 width: '94px',3170 height: '8px'3171 });3172 });3173 it("textAlign:right", function() {3174 make({3175 iconAlign: 'right',3176 arrowAlign: 'bottom',3177 textAlign: 'right'3178 });3179 expect(button).toHaveLayout({3180 el: {3181 w: 100,3182 h: (shrinkHeight && !stretch) ? 32 : 1003183 },3184 btnIconEl: {3185 x: 81,3186 y: (shrinkHeight && !stretch) ? 3 : 37,3187 w: 16,3188 h: 163189 },3190 '.btn-text-content': {3191 x: shrinkWidth ? 7 : 57,3192 y: shrinkHeight ? 3 : 37,3193 w: shrinkWidth ? 70 : 20,3194 h: stretch ? 84 : 163195 }3196 });3197 expectIconPosition();3198 expectArrowStyle({3199 display: Ext.isIE9m ? 'table-row' : 'block',3200 width: '94px',3201 height: '8px'3202 });3203 });3204 });3205 });3206 describe("iconAlign:bottom", function() {3207 describe("arrowAlign:right", function() {3208 it("no text", function() {3209 make({3210 iconAlign: 'bottom',3211 arrowAlign: 'right',3212 text: ''3213 });3214 expect(button).toHaveLayout({3215 el: {3216 w: shrinkWidth ? 34 : 100,3217 h: shrinkHeight? 22 : 1003218 },3219 btnIconEl: {3220 x: 3,3221 y: shrinkHeight ? 3 : 42,3222 w: shrinkWidth ? 16 : 82,3223 h: 163224 }3225 });3226 expectIconPosition();3227 expectArrowStyle({3228 display: Ext.isIE9m ? 'table-cell' : 'flex',3229 width: '8px',3230 height: shrinkHeight ? '16px' : '94px'3231 });3232 });3233 it("textAlign:left", function() {3234 make({3235 iconAlign: 'bottom',3236 arrowAlign: 'right',3237 textAlign: 'left'3238 });3239 expect(button).toHaveLayout({3240 el: {3241 w: 100,3242 h: (shrinkHeight && !stretch) ? 42 : 1003243 },3244 btnIconEl: {3245 x: 3,3246 y: shrinkHeight ? (stretch ? 81 : 23) : 52,3247 w: 86,3248 h: 163249 },3250 '.btn-text-content': {3251 x: 7,3252 y: (shrinkHeight || stretch) ? 3 : 32,3253 w: shrinkWidth ? 78 : 20,3254 h: stretch ? 74 : 163255 }3256 });3257 expectIconPosition();3258 expectArrowStyle({3259 display: Ext.isIE9m ? 'table-cell' : 'flex',3260 width: '8px',3261 height: (shrinkHeight && !stretch) ? '36px' : '94px'3262 });3263 });3264 it("textAlign:center", function() {3265 make({3266 iconAlign: 'bottom',3267 arrowAlign: 'right',3268 textAlign: 'center'3269 });3270 expect(button).toHaveLayout({3271 el: {3272 w: 100,3273 h: (shrinkHeight && !stretch) ? 42 : 1003274 },3275 btnIconEl: {3276 x: 3,3277 y: shrinkHeight ? (stretch ? 81 : 23) : 52,3278 w: 86,3279 h: 163280 },3281 '.btn-text-content': {3282 x: shrinkWidth ? 7 : 36,3283 y: (shrinkHeight || stretch) ? 3 : 32,3284 w: shrinkWidth ? 78 : 20,3285 h: stretch ? 74 : 163286 }3287 });3288 expectIconPosition();3289 expectArrowStyle({3290 display: Ext.isIE9m ? 'table-cell' : 'flex',3291 width: '8px',3292 height: (shrinkHeight && !stretch) ? '36px' : '94px'3293 });3294 });3295 it("textAlign:right", function() {3296 make({3297 iconAlign: 'bottom',3298 arrowAlign: 'right',3299 textAlign: 'right'3300 });3301 expect(button).toHaveLayout({3302 el: {3303 w: 100,3304 h: (shrinkHeight && !stretch) ? 42 : 1003305 },3306 btnIconEl: {3307 x: 3,3308 y: shrinkHeight ? (stretch ? 81 : 23) : 52,3309 w: 86,3310 h: 163311 },3312 '.btn-text-content': {3313 x: shrinkWidth ? 7 : 65,3314 y: (shrinkHeight || stretch) ? 3 : 32,3315 w: shrinkWidth ? 78 : 20,3316 h: stretch ? 74 : 163317 }3318 });3319 expectIconPosition();3320 expectArrowStyle({3321 display: Ext.isIE9m ? 'table-cell' : 'flex',3322 width: '8px',3323 height: (shrinkHeight && !stretch) ? '36px' : '94px'3324 });3325 });3326 });3327 describe("arrowAlign:bottom", function() {3328 it("no text", function() {3329 make({3330 iconAlign: 'bottom',3331 arrowAlign: 'bottom',3332 text: ''3333 });3334 expect(button).toHaveLayout({3335 el: {3336 w: shrinkWidth ? 22 : 100,3337 h: shrinkHeight? 32 : 1003338 },3339 btnIconEl: {3340 x: 3,3341 y: shrinkHeight ? 3 : 37,3342 w: shrinkWidth ? 16 : 94,3343 h: 163344 }3345 });3346 expectIconPosition();3347 expectArrowStyle({3348 display: Ext.isIE9m ? 'table-row' : 'block',3349 width: shrinkWidth ? '16px' : '94px',3350 height: '8px'3351 });3352 });3353 it("textAlign:left", function() {3354 make({3355 iconAlign: 'bottom',3356 arrowAlign: 'bottom',3357 textAlign: 'left'3358 });3359 expect(button).toHaveLayout({3360 el: {3361 w: 100,3362 h: (shrinkHeight && !stretch) ? 52 : 1003363 },3364 btnIconEl: {3365 x: 3,3366 y: shrinkHeight ? (stretch ? 71 : 23) : 47,3367 w: 94,3368 h: 163369 },3370 '.btn-text-content': {3371 x: 7,3372 y: (shrinkHeight || stretch) ? 3 : 27,3373 w: shrinkWidth ? 86 : 20,3374 h: stretch ? 64 : 163375 }3376 });3377 expectIconPosition();3378 expectArrowStyle({3379 display: Ext.isIE9m ? 'table-row' : 'block',3380 width: '94px',3381 height: '8px'3382 });3383 });3384 it("textAlign:center", function() {3385 make({3386 iconAlign: 'bottom',3387 arrowAlign: 'bottom',3388 textAlign: 'center'3389 });3390 expect(button).toHaveLayout({3391 el: {3392 w: 100,3393 h: (shrinkHeight && !stretch) ? 52 : 1003394 },3395 btnIconEl: {3396 x: 3,3397 y: shrinkHeight ? (stretch ? 71 : 23) : 47,3398 w: 94,3399 h: 163400 },3401 '.btn-text-content': {3402 x: shrinkWidth ? 7 : 40,3403 y: (shrinkHeight || stretch) ? 3 : 27,3404 w: shrinkWidth ? 86 : 20,3405 h: stretch ? 64 : 163406 }3407 });3408 expectIconPosition();3409 expectArrowStyle({3410 display: Ext.isIE9m ? 'table-row' : 'block',3411 width: '94px',3412 height: '8px'3413 });3414 });3415 it("textAlign:right", function() {3416 make({3417 iconAlign: 'bottom',3418 arrowAlign: 'bottom',3419 textAlign: 'right'3420 });3421 expect(button).toHaveLayout({3422 el: {3423 w: 100,3424 h: (shrinkHeight && !stretch) ? 52 : 1003425 },3426 btnIconEl: {3427 x: 3,3428 y: shrinkHeight ? (stretch ? 71 : 23) : 47,3429 w: 94,3430 h: 163431 },3432 '.btn-text-content': {3433 x: shrinkWidth ? 7 : 73,3434 y: (shrinkHeight || stretch) ? 3 : 27,3435 w: shrinkWidth ? 86 : 20,3436 h: stretch ? 64 : 163437 }3438 });3439 expectIconPosition();3440 expectArrowStyle({3441 display: Ext.isIE9m ? 'table-row' : 'block',3442 width: '94px',3443 height: '8px'3444 });3445 });3446 });3447 });3448 describe("iconAlign:left", function() {3449 describe("arrowAlign:right", function() {3450 it("no text", function() {3451 make({3452 iconAlign: 'left',3453 arrowAlign: 'right',3454 text: ''3455 });3456 expect(button).toHaveLayout({3457 el: {3458 w: shrinkWidth ? 34 : 100,3459 h: shrinkHeight? 22 : 1003460 },3461 btnIconEl: {3462 x: shrinkWidth ? 3 : 36,3463 y: shrinkHeight ? 3 : 42,3464 w: 16,3465 h: 163466 }3467 });3468 expectIconPosition();3469 expectArrowStyle({3470 display: Ext.isIE9m ? 'table-cell' : 'flex',3471 width: '8px',3472 height: shrinkHeight ? '16px' : '94px'3473 });3474 });3475 it("textAlign:left", function() {3476 make({3477 iconAlign: 'left',3478 arrowAlign: 'right',3479 textAlign: 'left'3480 });3481 expect(button).toHaveLayout({3482 el: {3483 w: 100,3484 h: (shrinkHeight && !stretch) ? 22 : 1003485 },3486 btnIconEl: {3487 x: 3,3488 y: (shrinkHeight && !stretch) ? 3 : 42,3489 w: 16,3490 h: 163491 },3492 '.btn-text-content': {3493 x: 23,3494 y: shrinkHeight ? 3 : 42,3495 w: shrinkWidth ? 62 : 20,3496 h: stretch ? 94 : 163497 }3498 });3499 expectIconPosition();3500 expectArrowStyle({3501 display: Ext.isIE9m ? 'table-cell' : 'flex',3502 width: '8px',3503 height: (shrinkHeight && !stretch) ? '16px' : '94px'3504 });3505 });3506 it("textAlign:center", function() {3507 make({3508 iconAlign: 'left',3509 arrowAlign: 'right',3510 textAlign: 'center'3511 });3512 expect(button).toHaveLayout({3513 el: {3514 w: 100,3515 h: (shrinkHeight && !stretch) ? 22 : 1003516 },3517 btnIconEl: {3518 x: shrinkWidth ? 3 : 24,3519 y: (shrinkHeight && !stretch) ? 3 : 42,3520 w: 16,3521 h: 163522 },3523 '.btn-text-content': {3524 x: shrinkWidth ? 23 : 44,3525 y: shrinkHeight ? 3 : 42,3526 w: shrinkWidth ? 62 : 20,3527 h: stretch ? 94 : 163528 }3529 });3530 expectIconPosition();3531 expectArrowStyle({3532 display: Ext.isIE9m ? 'table-cell' : 'flex',3533 width: '8px',3534 height: (shrinkHeight && !stretch) ? '16px' : '94px'3535 });3536 });3537 it("textAlign:right", function() {3538 make({3539 iconAlign: 'left',3540 arrowAlign: 'right',3541 textAlign: 'right'3542 });3543 expect(button).toHaveLayout({3544 el: {3545 w: 100,3546 h: (shrinkHeight && !stretch) ? 22 : 1003547 },3548 btnIconEl: {3549 x: shrinkWidth ? 3 : 45,3550 y: (shrinkHeight && !stretch) ? 3 : 42,3551 w: 16,3552 h: 163553 },3554 '.btn-text-content': {3555 x: shrinkWidth ? 23 : 65,3556 y: shrinkHeight ? 3 : 42,3557 w: shrinkWidth ? 62 : 20,3558 h: stretch ? 94 : 163559 }3560 });3561 expectIconPosition();3562 expectArrowStyle({3563 display: Ext.isIE9m ? 'table-cell' : 'flex',3564 width: '8px',3565 height: (shrinkHeight && !stretch) ? '16px' : '94px'3566 });3567 });3568 });3569 describe("arrowAlign:bottom", function() {3570 it("no text", function() {3571 make({3572 iconAlign: 'left',3573 arrowAlign: 'bottom',3574 text: ''3575 });3576 expect(button).toHaveLayout({3577 el: {3578 w: shrinkWidth ? 22 : 100,3579 h: shrinkHeight? 32 : 1003580 },3581 btnIconEl: {3582 x: shrinkWidth ? 3 : 42,3583 y: shrinkHeight ? 3 : 37,3584 w: 16,3585 h: 163586 }3587 });3588 expectIconPosition();3589 expectArrowStyle({3590 display: Ext.isIE9m ? 'table-row' : 'block',3591 width: shrinkWidth ? '16px' : '94px',3592 height: '8px'3593 });3594 });3595 it("textAlign:left", function() {3596 make({3597 iconAlign: 'left',3598 arrowAlign: 'bottom',3599 textAlign: 'left'3600 });3601 expect(button).toHaveLayout({3602 el: {3603 w: 100,3604 h: (shrinkHeight && !stretch) ? 32 : 1003605 },3606 btnIconEl: {3607 x: 3,3608 y: (shrinkHeight && !stretch) ? 3 : 37,3609 w: 16,3610 h: 163611 },3612 '.btn-text-content': {3613 x: 23,3614 y: shrinkHeight ? 3 : 37,3615 w: shrinkWidth ? 70 : 20,3616 h: stretch ? 84 : 163617 }3618 });3619 expectIconPosition();3620 expectArrowStyle({3621 display: Ext.isIE9m ? 'table-row' : 'block',3622 width: '94px',3623 height: '8px'3624 });3625 });3626 it("textAlign:center", function() {3627 make({3628 iconAlign: 'left',3629 arrowAlign: 'bottom',3630 textAlign: 'center'3631 });3632 expect(button).toHaveLayout({3633 el: {3634 w: 100,3635 h: (shrinkHeight && !stretch) ? 32 : 1003636 },3637 btnIconEl: {3638 x: shrinkWidth ? 3: 28,3639 y: (shrinkHeight && !stretch) ? 3 : 37,3640 w: 16,3641 h: 163642 },3643 '.btn-text-content': {3644 x: shrinkWidth ? 23 : 48,3645 y: shrinkHeight ? 3 : 37,3646 w: shrinkWidth ? 70 : 20,3647 h: stretch ? 84 : 163648 }3649 });3650 expectIconPosition();3651 expectArrowStyle({3652 display: Ext.isIE9m ? 'table-row' : 'block',3653 width: '94px',3654 height: '8px'3655 });3656 });3657 it("textAlign:right", function() {3658 make({3659 iconAlign: 'left',3660 arrowAlign: 'bottom',3661 textAlign: 'right'3662 });3663 expect(button).toHaveLayout({3664 el: {3665 w: 100,3666 h: (shrinkHeight && !stretch) ? 32 : 1003667 },3668 btnIconEl: {3669 x: shrinkWidth ? 3: 53,3670 y: (shrinkHeight && !stretch) ? 3 : 37,3671 w: 16,3672 h: 163673 },3674 '.btn-text-content': {3675 x: shrinkWidth ? 23 : 73,3676 y: shrinkHeight ? 3 : 37,3677 w: shrinkWidth ? 70 : 20,3678 h: stretch ? 84 : 163679 }3680 });3681 expectIconPosition();3682 expectArrowStyle({3683 display: Ext.isIE9m ? 'table-row' : 'block',3684 width: '94px',3685 height: '8px'3686 });3687 });3688 });3689 });3690 });3691 describe("with icon and split arrow", function() {3692 function make(config) {3693 var iconAlign = config.iconAlign,3694 bottomArrow = config.arrowAlign === 'bottom',3695 textWidth,3696 textHeight;3697 if (iconAlign === 'top' || iconAlign === 'bottom') {3698 textWidth = bottomArrow ? 86 : 72;3699 textHeight = bottomArrow ? 58 : 74;3700 } else if (iconAlign === 'right') {3701 textWidth = bottomArrow ? 70 : 52;3702 textHeight = bottomArrow ? 78 : 94;3703 } else if (iconAlign === 'left') {3704 textWidth = bottomArrow ? 70 : 56;3705 textHeight = bottomArrow ? 78 : 94;3706 }3707 makeButton(Ext.apply({3708 xtype: 'splitbutton',3709 iconCls: 'spec-icon',3710 text: getButtonText(3711 shrinkWidth ? textWidth : 20,3712 stretch ? textHeight : null3713 )3714 }, config));3715 }3716 describe("iconAlign:top", function() {3717 describe("arrowAlign:right", function() {3718 it("no text", function() {3719 make({3720 iconAlign: 'top',3721 arrowAlign: 'right',3722 text: ''3723 });3724 expect(button).toHaveLayout({3725 el: {3726 w: shrinkWidth ? 40 : 100,3727 h: shrinkHeight? 22 : 1003728 },3729 btnIconEl: {3730 x: 3,3731 y: shrinkHeight ? 3 : 42,3732 w: shrinkWidth ? 16 : 76,3733 h: 163734 }3735 });3736 expectIconPosition();3737 expectArrowStyle({3738 display: Ext.isIE9m ? 'table-cell' : 'flex',3739 width: '14px',3740 height: shrinkHeight ? '16px' : '94px'3741 });3742 });3743 it("textAlign:left", function() {3744 make({3745 iconAlign: 'top',3746 arrowAlign: 'right',3747 textAlign: 'left'3748 });3749 expect(button).toHaveLayout({3750 el: {3751 w: 100,3752 h: (shrinkHeight && !stretch) ? 42 : 1003753 },3754 btnIconEl: {3755 x: 3,3756 y: shrinkHeight ? 3 : 32,3757 w: 80,3758 h: 163759 },3760 '.btn-text-content': {3761 x: 7,3762 y: shrinkHeight ? 23 : 52,3763 w: shrinkWidth ? 72 : 20,3764 h: stretch ? 74 : 163765 }3766 });3767 expectIconPosition();3768 expectArrowStyle({3769 display: Ext.isIE9m ? 'table-cell' : 'flex',3770 width: '14px',3771 height: (shrinkHeight && !stretch) ? '36px' : '94px'3772 });3773 });3774 it("textAlign:center", function() {3775 make({3776 iconAlign: 'top',3777 arrowAlign: 'right',3778 textAlign: 'center'3779 });3780 expect(button).toHaveLayout({3781 el: {3782 w: 100,3783 h: (shrinkHeight && !stretch) ? 42 : 1003784 },3785 btnIconEl: {3786 x: 3,3787 y: shrinkHeight ? 3 : 32,3788 w: 80,3789 h: 163790 },3791 '.btn-text-content': {3792 x: shrinkWidth ? 7 : 33,3793 y: shrinkHeight ? 23 : 52,3794 w: shrinkWidth ? 72 : 20,3795 h: stretch ? 74 : 163796 }3797 });3798 expectIconPosition();3799 expectArrowStyle({3800 display: Ext.isIE9m ? 'table-cell' : 'flex',3801 width: '14px',3802 height: (shrinkHeight && !stretch) ? '36px' : '94px'3803 });3804 });3805 it("textAlign:right", function() {3806 make({3807 iconAlign: 'top',3808 arrowAlign: 'right',3809 textAlign: 'right'3810 });3811 expect(button).toHaveLayout({3812 el: {3813 w: 100,3814 h: (shrinkHeight && !stretch) ? 42 : 1003815 },3816 btnIconEl: {3817 x: 3,3818 y: shrinkHeight ? 3 : 32,3819 w: 80,3820 h: 163821 },3822 '.btn-text-content': {3823 x: shrinkWidth ? 7 : 59,3824 y: shrinkHeight ? 23 : 52,3825 w: shrinkWidth ? 72 : 20,3826 h: stretch ? 74 : 163827 }3828 });3829 expectIconPosition();3830 expectArrowStyle({3831 display: Ext.isIE9m ? 'table-cell' : 'flex',3832 width: '14px',3833 height: (shrinkHeight && !stretch) ? '36px' : '94px'3834 });3835 });3836 });3837 describe("arrowAlign:bottom", function() {3838 it("no text", function() {3839 make({3840 iconAlign: 'top',3841 arrowAlign: 'bottom',3842 text: ''3843 });3844 expect(button).toHaveLayout({3845 el: {3846 w: shrinkWidth ? 22 : 100,3847 h: shrinkHeight? 38 : 1003848 },3849 btnIconEl: {3850 x: 3,3851 y: shrinkHeight ? 3 : 34,3852 w: shrinkWidth ? 16 : 94,3853 h: 163854 }3855 });3856 expectIconPosition();3857 expectArrowStyle({3858 display: Ext.isIE9m ? 'table-row' : 'block',3859 width: shrinkWidth ? '16px' : '94px',3860 height: '14px'3861 });3862 });3863 it("textAlign:left", function() {3864 make({3865 iconAlign: 'top',3866 arrowAlign: 'bottom',3867 textAlign: 'left'3868 });3869 expect(button).toHaveLayout({3870 el: {3871 w: 100,3872 h: (shrinkHeight && !stretch) ? 58 : 1003873 },3874 btnIconEl: {3875 x: 3,3876 y: shrinkHeight ? 3 : 24,3877 w: 94,3878 h: 163879 },3880 '.btn-text-content': {3881 x: 7,3882 y: shrinkHeight ? 23 : 44,3883 w: shrinkWidth ? 86 : 20,3884 h: stretch ? 58 : 163885 }3886 });3887 expectIconPosition();3888 expectArrowStyle({3889 display: Ext.isIE9m ? 'table-row' : 'block',3890 width: '94px',3891 height: '14px'3892 });3893 });3894 it("textAlign:center", function() {3895 make({3896 iconAlign: 'top',3897 arrowAlign: 'bottom',3898 textAlign: 'center'3899 });3900 expect(button).toHaveLayout({3901 el: {3902 w: 100,3903 h: (shrinkHeight && !stretch) ? 58 : 1003904 },3905 btnIconEl: {3906 x: 3,3907 y: shrinkHeight ? 3 : 24,3908 w: 94,3909 h: 163910 },3911 '.btn-text-content': {3912 x: shrinkWidth ? 7 : 40,3913 y: shrinkHeight ? 23 : 44,3914 w: shrinkWidth ? 86 : 20,3915 h: stretch ? 58 : 163916 }3917 });3918 expectIconPosition();3919 expectArrowStyle({3920 display: Ext.isIE9m ? 'table-row' : 'block',3921 width: '94px',3922 height: '14px'3923 });3924 });3925 it("textAlign:right", function() {3926 make({3927 iconAlign: 'top',3928 arrowAlign: 'bottom',3929 textAlign: 'right'3930 });3931 expect(button).toHaveLayout({3932 el: {3933 w: 100,3934 h: (shrinkHeight && !stretch) ? 58 : 1003935 },3936 btnIconEl: {3937 x: 3,3938 y: shrinkHeight ? 3 : 24,3939 w: 94,3940 h: 163941 },3942 '.btn-text-content': {3943 x: shrinkWidth ? 7 : 73,3944 y: shrinkHeight ? 23 : 44,3945 w: shrinkWidth ? 86 : 20,3946 h: stretch ? 58 : 163947 }3948 });3949 expectIconPosition();3950 expectArrowStyle({3951 display: Ext.isIE9m ? 'table-row' : 'block',3952 width: '94px',3953 height: '14px'3954 });3955 });3956 });3957 });3958 describe("iconAlign:right", function() {3959 describe("arrowAlign:right", function() {3960 it("no text", function() {3961 make({3962 iconAlign: 'right',3963 arrowAlign: 'right',3964 text: ''3965 });3966 expect(button).toHaveLayout({3967 el: {3968 w: shrinkWidth ? 40 : 100,3969 h: shrinkHeight? 22 : 1003970 },3971 btnIconEl: {3972 x: shrinkWidth ? 3 : 33,3973 y: shrinkHeight ? 3 : 42,3974 w: 16,3975 h: 163976 }3977 });3978 expectIconPosition();3979 expectArrowStyle({3980 display: Ext.isIE9m ? 'table-cell' : 'flex',3981 width: '14px',3982 height: shrinkHeight ? '16px' : '94px'3983 });3984 });3985 it("textAlign:left", function() {3986 make({3987 iconAlign: 'right',3988 arrowAlign: 'right',3989 textAlign: 'left'3990 });3991 expect(button).toHaveLayout({3992 el: {3993 w: 100,3994 h: (shrinkHeight && !stretch) ? 22 : 1003995 },3996 btnIconEl: {3997 x: shrinkWidth ? 63 : 31,3998 y: (shrinkHeight && !stretch) ? 3 : 42,3999 w: 16,4000 h: 164001 },4002 '.btn-text-content': {4003 x: 7,4004 y: shrinkHeight ? 3 : 42,4005 w: shrinkWidth ? 52 : 20,4006 h: stretch ? 94 : 164007 }4008 });4009 expectIconPosition();4010 expectArrowStyle({4011 display: Ext.isIE9m ? 'table-cell' : 'flex',4012 width: '14px',4013 height: (shrinkHeight && !stretch) ? '16px' : '94px'4014 });4015 });4016 it("textAlign:center", function() {4017 make({4018 iconAlign: 'right',4019 arrowAlign: 'right',4020 textAlign: 'center'4021 });4022 expect(button).toHaveLayout({4023 el: {4024 w: 100,4025 h: (shrinkHeight && !stretch) ? 22 : 1004026 },4027 btnIconEl: {4028 x: shrinkWidth ? 63 : 47,4029 y: (shrinkHeight && !stretch) ? 3 : 42,4030 w: 16,4031 h: 164032 },4033 '.btn-text-content': {4034 x: shrinkWidth ? 7 : 23,4035 y: shrinkHeight ? 3 : 42,4036 w: shrinkWidth ? 52 : 20,4037 h: stretch ? 94 : 164038 }4039 });4040 expectIconPosition();4041 expectArrowStyle({4042 display: Ext.isIE9m ? 'table-cell' : 'flex',4043 width: '14px',4044 height: (shrinkHeight && !stretch) ? '16px' : '94px'4045 });4046 });4047 it("textAlign:right", function() {4048 make({4049 iconAlign: 'right',4050 arrowAlign: 'right',4051 textAlign: 'right'4052 });4053 expect(button).toHaveLayout({4054 el: {4055 w: 100,4056 h: (shrinkHeight && !stretch) ? 22 : 1004057 },4058 btnIconEl: {4059 x: 63,4060 y: (shrinkHeight && !stretch) ? 3 : 42,4061 w: 16,4062 h: 164063 },4064 '.btn-text-content': {4065 x: shrinkWidth ? 7 : 39,4066 y: shrinkHeight ? 3 : 42,4067 w: shrinkWidth ? 52 : 20,4068 h: stretch ? 94 : 164069 }4070 });4071 expectIconPosition();4072 expectArrowStyle({4073 display: Ext.isIE9m ? 'table-cell' : 'flex',4074 width: '14px',4075 height: (shrinkHeight && !stretch) ? '16px' : '94px'4076 });4077 });4078 });4079 describe("arrowAlign:bottom", function() {4080 it("no text", function() {4081 make({4082 iconAlign: 'right',4083 arrowAlign: 'bottom',4084 text: ''4085 });4086 expect(button).toHaveLayout({4087 el: {4088 w: shrinkWidth ? 22 : 100,4089 h: shrinkHeight? 38 : 1004090 },4091 btnIconEl: {4092 x: shrinkWidth ? 3 : 42,4093 y: shrinkHeight ? 3 : 34,4094 w: 16,4095 h: 164096 }4097 });4098 expectIconPosition();4099 expectArrowStyle({4100 display: Ext.isIE9m ? 'table-row' : 'block',4101 width: shrinkWidth ? '16px' : '94px',4102 height: '14px'4103 });4104 });4105 it("textAlign:left", function() {4106 make({4107 iconAlign: 'right',4108 arrowAlign: 'bottom',4109 textAlign: 'left'4110 });4111 expect(button).toHaveLayout({4112 el: {4113 w: 100,4114 h: (shrinkHeight && !stretch) ? 38 : 1004115 },4116 btnIconEl: {4117 x: shrinkWidth ? 81 : 31,4118 y: (shrinkHeight && !stretch) ? 3 : 34,4119 w: 16,4120 h: 164121 },4122 '.btn-text-content': {4123 x: 7,4124 y: shrinkHeight ? 3 : 34,4125 w: shrinkWidth ? 70 : 20,4126 h: stretch ? 78 : 164127 }4128 });4129 expectIconPosition();4130 expectArrowStyle({4131 display: Ext.isIE9m ? 'table-row' : 'block',4132 width: '94px',4133 height: '14px'4134 });4135 });4136 it("textAlign:center", function() {4137 make({4138 iconAlign: 'right',4139 arrowAlign: 'bottom',4140 textAlign: 'center'4141 });4142 expect(button).toHaveLayout({4143 el: {4144 w: 100,4145 h: (shrinkHeight && !stretch) ? 38 : 1004146 },4147 btnIconEl: {4148 x: shrinkWidth ? 81 : 56,4149 y: (shrinkHeight && !stretch) ? 3 : 34,4150 w: 16,4151 h: 164152 },4153 '.btn-text-content': {4154 x: shrinkWidth ? 7 : 32,4155 y: shrinkHeight ? 3 : 34,4156 w: shrinkWidth ? 70 : 20,4157 h: stretch ? 78 : 164158 }4159 });4160 expectIconPosition();4161 expectArrowStyle({4162 display: Ext.isIE9m ? 'table-row' : 'block',4163 width: '94px',4164 height: '14px'4165 });4166 });4167 it("textAlign:right", function() {4168 make({4169 iconAlign: 'right',4170 arrowAlign: 'bottom',4171 textAlign: 'right'4172 });4173 expect(button).toHaveLayout({4174 el: {4175 w: 100,4176 h: (shrinkHeight && !stretch) ? 38 : 1004177 },4178 btnIconEl: {4179 x: 81,4180 y: (shrinkHeight && !stretch) ? 3 : 34,4181 w: 16,4182 h: 164183 },4184 '.btn-text-content': {4185 x: shrinkWidth ? 7 : 57,4186 y: shrinkHeight ? 3 : 34,4187 w: shrinkWidth ? 70 : 20,4188 h: stretch ? 78 : 164189 }4190 });4191 expectIconPosition();4192 expectArrowStyle({4193 display: Ext.isIE9m ? 'table-row' : 'block',4194 width: '94px',4195 height: '14px'4196 });4197 });4198 });4199 });4200 describe("iconAlign:bottom", function() {4201 describe("arrowAlign:right", function() {4202 it("no text", function() {4203 make({4204 iconAlign: 'bottom',4205 arrowAlign: 'right',4206 text: ''4207 });4208 expect(button).toHaveLayout({4209 el: {4210 w: shrinkWidth ? 40 : 100,4211 h: shrinkHeight? 22 : 1004212 },4213 btnIconEl: {4214 x: 3,4215 y: shrinkHeight ? 3 : 42,4216 w: shrinkWidth ? 16 : 76,4217 h: 164218 }4219 });4220 expectIconPosition();4221 expectArrowStyle({4222 display: Ext.isIE9m ? 'table-cell' : 'flex',4223 width: '14px',4224 height: shrinkHeight ? '16px' : '94px'4225 });4226 });4227 it("textAlign:left", function() {4228 make({4229 iconAlign: 'bottom',4230 arrowAlign: 'right',4231 textAlign: 'left'4232 });4233 expect(button).toHaveLayout({4234 el: {4235 w: 100,4236 h: (shrinkHeight && !stretch) ? 42 : 1004237 },4238 btnIconEl: {4239 x: 3,4240 y: shrinkHeight ? (stretch ? 81 : 23) : 52,4241 w: 80,4242 h: 164243 },4244 '.btn-text-content': {4245 x: 7,4246 y: (shrinkHeight || stretch) ? 3 : 32,4247 w: shrinkWidth ? 72 : 20,4248 h: stretch ? 74 : 164249 }4250 });4251 expectIconPosition();4252 expectArrowStyle({4253 display: Ext.isIE9m ? 'table-cell' : 'flex',4254 width: '14px',4255 height: (shrinkHeight && !stretch) ? '36px' : '94px'4256 });4257 });4258 it("textAlign:center", function() {4259 make({4260 iconAlign: 'bottom',4261 arrowAlign: 'right',4262 textAlign: 'center'4263 });4264 expect(button).toHaveLayout({4265 el: {4266 w: 100,4267 h: (shrinkHeight && !stretch) ? 42 : 1004268 },4269 btnIconEl: {4270 x: 3,4271 y: shrinkHeight ? (stretch ? 81 : 23) : 52,4272 w: 80,4273 h: 164274 },4275 '.btn-text-content': {4276 x: shrinkWidth ? 7 : 33,4277 y: (shrinkHeight || stretch) ? 3 : 32,4278 w: shrinkWidth ? 72 : 20,4279 h: stretch ? 74 : 164280 }4281 });4282 expectIconPosition();4283 expectArrowStyle({4284 display: Ext.isIE9m ? 'table-cell' : 'flex',4285 width: '14px',4286 height: (shrinkHeight && !stretch) ? '36px' : '94px'4287 });4288 });4289 it("textAlign:right", function() {4290 make({4291 iconAlign: 'bottom',4292 arrowAlign: 'right',4293 textAlign: 'right'4294 });4295 expect(button).toHaveLayout({4296 el: {4297 w: 100,4298 h: (shrinkHeight && !stretch) ? 42 : 1004299 },4300 btnIconEl: {4301 x: 3,4302 y: shrinkHeight ? (stretch ? 81 : 23) : 52,4303 w: 80,4304 h: 164305 },4306 '.btn-text-content': {4307 x: shrinkWidth ? 7 : 59,4308 y: (shrinkHeight || stretch) ? 3 : 32,4309 w: shrinkWidth ? 72 : 20,4310 h: stretch ? 74 : 164311 }4312 });4313 expectIconPosition();4314 expectArrowStyle({4315 display: Ext.isIE9m ? 'table-cell' : 'flex',4316 width: '14px',4317 height: (shrinkHeight && !stretch) ? '36px' : '94px'4318 });4319 });4320 });4321 describe("arrowAlign:bottom", function() {4322 it("no text", function() {4323 make({4324 iconAlign: 'bottom',4325 arrowAlign: 'bottom',4326 text: ''4327 });4328 expect(button).toHaveLayout({4329 el: {4330 w: shrinkWidth ? 22 : 100,4331 h: shrinkHeight? 38 : 1004332 },4333 btnIconEl: {4334 x: 3,4335 y: shrinkHeight ? 3 : 34,4336 w: shrinkWidth ? 16 : 94,4337 h: 164338 }4339 });4340 expectIconPosition();4341 expectArrowStyle({4342 display: Ext.isIE9m ? 'table-row' : 'block',4343 width: shrinkWidth ? '16px' : '94px',4344 height: '14px'4345 });4346 });4347 it("textAlign:left", function() {4348 make({4349 iconAlign: 'bottom',4350 arrowAlign: 'bottom',4351 textAlign: 'left'4352 });4353 expect(button).toHaveLayout({4354 el: {4355 w: 100,4356 h: (shrinkHeight && !stretch) ? 58 : 1004357 },4358 btnIconEl: {4359 x: 3,4360 y: shrinkHeight ? (stretch ? 65 : 23) : 44,4361 w: 94,4362 h: 164363 },4364 '.btn-text-content': {4365 x: 7,4366 y: (shrinkHeight || stretch) ? 3 : 24,4367 w: shrinkWidth ? 86 : 20,4368 h: stretch ? 58 : 164369 }4370 });4371 expectIconPosition();4372 expectArrowStyle({4373 display: Ext.isIE9m ? 'table-row' : 'block',4374 width: '94px',4375 height: '14px'4376 });4377 });4378 it("textAlign:center", function() {4379 make({4380 iconAlign: 'bottom',4381 arrowAlign: 'bottom',4382 textAlign: 'center'4383 });4384 expect(button).toHaveLayout({4385 el: {4386 w: 100,4387 h: (shrinkHeight && !stretch) ? 58 : 1004388 },4389 btnIconEl: {4390 x: 3,4391 y: shrinkHeight ? (stretch ? 65 : 23) : 44,4392 w: 94,4393 h: 164394 },4395 '.btn-text-content': {4396 x: shrinkWidth ? 7 : 40,4397 y: (shrinkHeight || stretch) ? 3 : 24,4398 w: shrinkWidth ? 86 : 20,4399 h: stretch ? 58 : 164400 }4401 });4402 expectIconPosition();4403 expectArrowStyle({4404 display: Ext.isIE9m ? 'table-row' : 'block',4405 width: '94px',4406 height: '14px'4407 });4408 });4409 it("textAlign:right", function() {4410 make({4411 iconAlign: 'bottom',4412 arrowAlign: 'bottom',4413 textAlign: 'right'4414 });4415 expect(button).toHaveLayout({4416 el: {4417 w: 100,4418 h: (shrinkHeight && !stretch) ? 58 : 1004419 },4420 btnIconEl: {4421 x: 3,4422 y: shrinkHeight ? (stretch ? 65 : 23) : 44,4423 w: 94,4424 h: 164425 },4426 '.btn-text-content': {4427 x: shrinkWidth ? 7 : 73,4428 y: (shrinkHeight || stretch) ? 3 : 24,4429 w: shrinkWidth ? 86 : 20,4430 h: stretch ? 58 : 164431 }4432 });4433 expectIconPosition();4434 expectArrowStyle({4435 display: Ext.isIE9m ? 'table-row' : 'block',4436 width: '94px',4437 height: '14px'4438 });4439 });4440 });4441 });4442 describe("iconAlign:left", function() {4443 describe("arrowAlign:right", function() {4444 it("no text", function() {4445 make({4446 iconAlign: 'left',4447 arrowAlign: 'right',4448 text: ''4449 });4450 expect(button).toHaveLayout({4451 el: {4452 w: shrinkWidth ? 40 : 100,4453 h: shrinkHeight? 22 : 1004454 },4455 btnIconEl: {4456 x: shrinkWidth ? 3 : 33,4457 y: shrinkHeight ? 3 : 42,4458 w: 16,4459 h: 164460 }4461 });4462 expectIconPosition();4463 expectArrowStyle({4464 display: Ext.isIE9m ? 'table-cell' : 'flex',4465 width: '14px',4466 height: shrinkHeight ? '16px' : '94px'4467 });4468 });4469 it("textAlign:left", function() {4470 make({4471 iconAlign: 'left',4472 arrowAlign: 'right',4473 textAlign: 'left'4474 });4475 expect(button).toHaveLayout({4476 el: {4477 w: 100,4478 h: (shrinkHeight && !stretch) ? 22 : 1004479 },4480 btnIconEl: {4481 x: 3,4482 y: (shrinkHeight && !stretch) ? 3 : 42,4483 w: 16,4484 h: 164485 },4486 '.btn-text-content': {4487 x: 23,4488 y: shrinkHeight ? 3 : 42,4489 w: shrinkWidth ? 56 : 20,4490 h: stretch ? 94 : 164491 }4492 });4493 expectIconPosition();4494 expectArrowStyle({4495 display: Ext.isIE9m ? 'table-cell' : 'flex',4496 width: '14px',4497 height: (shrinkHeight && !stretch) ? '16px' : '94px'4498 });4499 });4500 it("textAlign:center", function() {4501 make({4502 iconAlign: 'left',4503 arrowAlign: 'right',4504 textAlign: 'center'4505 });4506 expect(button).toHaveLayout({4507 el: {4508 w: 100,4509 h: (shrinkHeight && !stretch) ? 22 : 1004510 },4511 btnIconEl: {4512 x: shrinkWidth ? 3 : 21,4513 y: (shrinkHeight && !stretch) ? 3 : 42,4514 w: 16,4515 h: 164516 },4517 '.btn-text-content': {4518 x: shrinkWidth ? 23 : 41,4519 y: shrinkHeight ? 3 : 42,4520 w: shrinkWidth ? 56 : 20,4521 h: stretch ? 94 : 164522 }4523 });4524 expectIconPosition();4525 expectArrowStyle({4526 display: Ext.isIE9m ? 'table-cell' : 'flex',4527 width: '14px',4528 height: (shrinkHeight && !stretch) ? '16px' : '94px'4529 });4530 });4531 it("textAlign:right", function() {4532 make({4533 iconAlign: 'left',4534 arrowAlign: 'right',4535 textAlign: 'right'4536 });4537 expect(button).toHaveLayout({4538 el: {4539 w: 100,4540 h: (shrinkHeight && !stretch) ? 22 : 1004541 },4542 btnIconEl: {4543 x: shrinkWidth ? 3 : 39,4544 y: (shrinkHeight && !stretch) ? 3 : 42,4545 w: 16,4546 h: 164547 },4548 '.btn-text-content': {4549 x: shrinkWidth ? 23 : 59,4550 y: shrinkHeight ? 3 : 42,4551 w: shrinkWidth ? 56 : 20,4552 h: stretch ? 94 : 164553 }4554 });4555 expectIconPosition();4556 expectArrowStyle({4557 display: Ext.isIE9m ? 'table-cell' : 'flex',4558 width: '14px',4559 height: (shrinkHeight && !stretch) ? '16px' : '94px'4560 });4561 });4562 });4563 describe("arrowAlign:bottom", function() {4564 it("no text", function() {4565 make({4566 iconAlign: 'left',4567 arrowAlign: 'bottom',4568 text: ''4569 });4570 expect(button).toHaveLayout({4571 el: {4572 w: shrinkWidth ? 22 : 100,4573 h: shrinkHeight? 38 : 1004574 },4575 btnIconEl: {4576 x: shrinkWidth ? 3 : 42,4577 y: shrinkHeight ? 3 : 34,4578 w: 16,4579 h: 164580 }4581 });4582 expectIconPosition();4583 expectArrowStyle({4584 display: Ext.isIE9m ? 'table-row' : 'block',4585 width: shrinkWidth ? '16px' : '94px',4586 height: '14px'4587 });4588 });4589 it("textAlign:left", function() {4590 make({4591 iconAlign: 'left',4592 arrowAlign: 'bottom',4593 textAlign: 'left'4594 });4595 expect(button).toHaveLayout({4596 el: {4597 w: 100,4598 h: (shrinkHeight && !stretch) ? 38 : 1004599 },4600 btnIconEl: {4601 x: 3,4602 y: (shrinkHeight && !stretch) ? 3 : 34,4603 w: 16,4604 h: 164605 },4606 '.btn-text-content': {4607 x: 23,4608 y: shrinkHeight ? 3 : 34,4609 w: shrinkWidth ? 70 : 20,4610 h: stretch ? 78 : 164611 }4612 });4613 expectIconPosition();4614 expectArrowStyle({4615 display: Ext.isIE9m ? 'table-row' : 'block',4616 width: '94px',4617 height: '14px'4618 });4619 });4620 it("textAlign:center", function() {4621 make({4622 iconAlign: 'left',4623 arrowAlign: 'bottom',4624 textAlign: 'center'4625 });4626 expect(button).toHaveLayout({4627 el: {4628 w: 100,4629 h: (shrinkHeight && !stretch) ? 38 : 1004630 },4631 btnIconEl: {4632 x: shrinkWidth ? 3: 28,4633 y: (shrinkHeight && !stretch) ? 3 : 34,4634 w: 16,4635 h: 164636 },4637 '.btn-text-content': {4638 x: shrinkWidth ? 23 : 48,4639 y: shrinkHeight ? 3 : 34,4640 w: shrinkWidth ? 70 : 20,4641 h: stretch ? 78 : 164642 }4643 });4644 expectIconPosition();4645 expectArrowStyle({4646 display: Ext.isIE9m ? 'table-row' : 'block',4647 width: '94px',4648 height: '14px'4649 });4650 });4651 it("textAlign:right", function() {4652 make({4653 iconAlign: 'left',4654 arrowAlign: 'bottom',4655 textAlign: 'right'4656 });4657 expect(button).toHaveLayout({4658 el: {4659 w: 100,4660 h: (shrinkHeight && !stretch) ? 38 : 1004661 },4662 btnIconEl: {4663 x: shrinkWidth ? 3: 53,4664 y: (shrinkHeight && !stretch) ? 3 : 34,4665 w: 16,4666 h: 164667 },4668 '.btn-text-content': {4669 x: shrinkWidth ? 23 : 73,4670 y: shrinkHeight ? 3 : 34,4671 w: shrinkWidth ? 70 : 20,4672 h: stretch ? 78 : 164673 }4674 });4675 expectIconPosition();4676 expectArrowStyle({4677 display: Ext.isIE9m ? 'table-row' : 'block',4678 width: '94px',4679 height: '14px'4680 });4681 });4682 });4683 });4684 });4685 });4686 }4687 makeLayoutSuite(0); // fixed width and height4688 makeLayoutSuite(1); // shrinkWrap width4689 makeLayoutSuite(2); // shrinkWrap height4690 makeLayoutSuite(2, true); // shrinkWrap height, stretch contents vertically4691 makeLayoutSuite(3); // shrinkWrap both4692 makeLayoutSuite(3, true); // shrinkWrap both, stretch contents vertically4693 4694 describe("syncing the table-layout of the btnWrap when the button width changes", function() {4695 var btnWrap;4696 4697 describe("setting the width", function() {4698 beforeEach(function() {4699 button = Ext.create({4700 xtype: 'button',4701 renderTo: document.body,4702 text: 'Hello'4703 });4704 btnWrap = button.btnWrap;4705 });4706 4707 it("should initially render with table-layout:auto", function() {4708 expect(btnWrap.getStyle('table-layout')).toBe('auto');4709 });4710 4711 it("should add table-layout:fixed - using component.setWidth()", function() {4712 button.setWidth(100);4713 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4714 });4715 4716 it("should add table-layout:fixed - using component.setSize()", function() {4717 button.setSize(100, 100);4718 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4719 });4720 it("should add table-layout:fixed - using el.setWidth()", function() {4721 button.el.setWidth(100);4722 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4723 });4724 it("should add table-layout:fixed - using el.setSize()", function() {4725 button.el.setSize(100, 100);4726 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4727 });4728 it("should add table-layout:fixed - using el.setStyle('width')", function() {4729 button.el.setStyle('width', '100px');4730 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4731 });4732 4733 it("should add table-layout:fixed - using el.setStyle({ width: width }}", function() {4734 button.el.setStyle({ width: '100px'});4735 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4736 });4737 });4738 4739 describe("removing the width", function() {4740 beforeEach(function() {4741 button = Ext.create({4742 xtype: 'button',4743 renderTo: document.body,4744 width: 100,4745 text: 'Hello'4746 });4747 btnWrap = button.btnWrap;4748 });4749 it("should initially render with table-layout:fixed", function() {4750 expect(btnWrap.getStyle('table-layout')).toBe('fixed');4751 });4752 it("should remove table-layout:fixed - using component.setWidth()", function() {4753 button.setWidth(null);4754 expect(btnWrap.getStyle('table-layout')).toBe('auto');4755 });4756 it("should remove table-layout:fixed - using component.setSize()", function() {4757 button.setSize(null, null);4758 expect(btnWrap.getStyle('table-layout')).toBe('auto');4759 });4760 it("should remove table-layout:fixed - using el.setWidth()", function() {4761 button.el.setWidth(null);4762 expect(btnWrap.getStyle('table-layout')).toBe('auto');4763 });4764 it("should remove table-layout:fixed - using el.setSize()", function() {4765 button.el.setSize(null, null);4766 expect(btnWrap.getStyle('table-layout')).toBe('auto');4767 });4768 it("should remove table-layout:fixed - using el.setStyle('width')", function() {4769 button.el.setStyle('width', '');4770 expect(btnWrap.getStyle('table-layout')).toBe('auto');4771 });4772 it("should remove table-layout:fixed - using el.setStyle({ width: width }}", function() {4773 button.el.setStyle({ width: ''});4774 expect(btnWrap.getStyle('table-layout')).toBe('auto');4775 });4776 });4777 });4778 describe("syncing the height style of the btnEl when the button height changes", function() {4779 var btnEl;4780 describe("setting the height", function() {4781 beforeEach(function() {4782 button = Ext.create({4783 xtype: 'button',4784 renderTo: document.body,4785 text: 'Hello'4786 });4787 btnEl = button.btnEl;4788 });4789 it("should initially render with a fixed height from the stylesheet", function() {4790 expect(btnEl.dom.style.height).toBe('');4791 });4792 it("should add height:auto - using component.setHeight()", function() {4793 button.setHeight(100);4794 expect(btnEl.dom.style.height).toBe('auto');4795 });4796 it("should add height:auto - using component.setSize()", function() {4797 button.setSize(100, 100);4798 expect(btnEl.dom.style.height).toBe('auto');4799 });4800 it("should add height:auto - using el.setHeight()", function() {4801 button.el.setHeight(100);4802 expect(btnEl.dom.style.height).toBe('auto');4803 });4804 it("should add height:auto - using el.setSize()", function() {4805 button.el.setSize(100, 100);4806 expect(btnEl.dom.style.height).toBe('auto');4807 });4808 it("should add height:auto - using el.setStyle('height')", function() {4809 button.el.setStyle('height', '100px');4810 expect(btnEl.dom.style.height).toBe('auto');4811 });4812 it("should add height:auto - using el.setStyle({ height: height }}", function() {4813 button.el.setStyle({ height: '100px'});4814 expect(btnEl.dom.style.height).toBe('auto');4815 });4816 });4817 describe("removing the height", function() {4818 beforeEach(function() {4819 button = Ext.create({4820 xtype: 'button',4821 renderTo: document.body,4822 height: 100,4823 text: 'Hello'4824 });4825 btnEl = button.btnEl;4826 });4827 it("should initially render with auto height", function() {4828 expect(btnEl.dom.style.height).toBe('auto');4829 });4830 it("should remove height:auto - using component.setHeight()", function() {4831 button.setHeight(null);4832 expect(btnEl.dom.style.height).toBe('');4833 });4834 it("should remove height:auto - using component.setSize()", function() {4835 button.setSize(null, null);4836 expect(btnEl.dom.style.height).toBe('');4837 });4838 it("should remove height:auto - using el.setHeight()", function() {4839 button.el.setHeight(null);4840 expect(btnEl.dom.style.height).toBe('');4841 });4842 it("should remove height:auto - using el.setSize()", function() {4843 button.el.setSize(null, null);4844 expect(btnEl.dom.style.height).toBe('');4845 });4846 it("should remove height:auto - using el.setStyle('height')", function() {4847 button.el.setStyle('height', '');4848 expect(btnEl.dom.style.height).toBe('');4849 });4850 it("should remove height:auto - using el.setStyle({ height: height }}", function() {4851 button.el.setStyle({ height: ''});4852 expect(btnEl.dom.style.height).toBe('');4853 });4854 });4855 });4856 if (Ext.isIE8) {4857 describe("syncing the frame height when the button height changes", function() {4858 var frameBody;4859 4860 describe("setting the height", function() {4861 beforeEach(function() {4862 button = Ext.create({4863 xtype: 'button',4864 renderTo: document.body,4865 text: 'Hello'4866 });4867 frameBody = button.frameBody;4868 });4869 4870 it("should initially render with auto height", function() {4871 expect(frameBody.getStyle('height')).toBe('auto');4872 });4873 4874 it("should set the frameBody height - using component.setHeight()", function() {4875 button.setHeight(100);4876 expect(frameBody.getStyle('height')).toBe('94px');4877 });4878 4879 it("should set the frameBody height - using component.setSize()", function() {4880 button.setSize(100, 100);4881 expect(frameBody.getStyle('height')).toBe('94px');4882 });4883 4884 it("should set the frameBody height - using el.setHeight()", function() {4885 button.el.setHeight(100);4886 expect(frameBody.getStyle('height')).toBe('94px');4887 });4888 4889 it("should set the frameBody height - using el.setSize()", function() {4890 button.el.setSize(100, 100);4891 expect(frameBody.getStyle('height')).toBe('94px');4892 });4893 4894 it("should set the frameBody height - using el.setStyle('height')", function() {4895 button.el.setStyle('height', '100px');4896 expect(frameBody.getStyle('height')).toBe('94px');4897 });4898 4899 it("should set the frameBody height - using el.setStyle({ height: height }}", function() {4900 button.el.setStyle({ height: '100px'});4901 expect(frameBody.getStyle('height')).toBe('94px');4902 });4903 });4904 4905 describe("removing the height", function() {4906 beforeEach(function() {4907 button = Ext.create({4908 xtype: 'button',4909 renderTo: document.body,4910 height: 100,4911 text: 'Hello'4912 });4913 frameBody = button.frameBody;4914 });4915 4916 it("should initially render with the specified height", function() {4917 expect(frameBody.getStyle('height')).toBe('94px');4918 });4919 4920 it("should remove the frameBody height - using component.setHeight()", function() {4921 button.setHeight(null);4922 expect(frameBody.getStyle('height')).toBe('auto');4923 });4924 4925 it("should remove the frameBody height - using component.setSize()", function() {4926 button.setSize(null, null);4927 expect(frameBody.getStyle('height')).toBe('auto');4928 });4929 4930 it("should remove the frameBody height - using el.setHeight()", function() {4931 button.el.setHeight(null);4932 expect(frameBody.getStyle('height')).toBe('auto');4933 });4934 4935 it("should remove the frameBody height - using el.setSize()", function() {4936 button.el.setSize(null, null);4937 expect(frameBody.getStyle('height')).toBe('auto');4938 });4939 4940 it("should remove the frameBody height - using el.setStyle('height')", function() {4941 button.el.setStyle('height', '');4942 expect(frameBody.getStyle('height')).toBe('auto');4943 });4944 4945 it("should remove the frameBody height - using el.setStyle({ height: height }}", function() {4946 button.el.setStyle({ height: ''});4947 expect(frameBody.getStyle('height')).toBe('auto');4948 });4949 });4950 });4951 }4952 it("should be able to have a height of 0", function(){4953 expect(function() {4954 makeButton({4955 renderTo: Ext.getBody(),4956 height: 04957 });4958 }).not.toThrow();4959 });4960 it("should be able to size larger after hitting a minWidth constraint", function() {4961 makeButton({4962 renderTo: Ext.getBody(),4963 minWidth: 75,4964 text: 'Foo'4965 });4966 button.setText('Text that will stretch longer than 75px');4967 expect(button.getWidth()).toBeGreaterThan(75);4968 });4969 it("should layout shrinkwrap width button with right arrow in an overflowing hbox layout", function() {4970 // ARIA warnings about splitbuttons are expected4971 spyOn(Ext.log, 'warn');4972 4973 var toolbar = Ext.create({4974 xtype: 'toolbar',4975 renderTo: document.body,4976 width: 75,4977 overflowHandler: 'scroller',4978 items: [{4979 xtype: 'splitbutton',4980 text: '<span style="display:inline-block;width:72px;background-color:red;"></span>'4981 }, {4982 xtype: 'button',4983 text: '<span style="display:inline-block;width:78px;background-color:red;"></span>',4984 menu: []4985 }]4986 });4987 expect(toolbar.items.getAt(0).getWidth()).toBe(100);4988 expect(toolbar.items.getAt(1).getWidth()).toBe(100);4989 toolbar.destroy();4990 });4991 it("should layout shrinkwrap height button with bottom arrow in an overflowing vbox layout", function() {4992 // ARIA warnings about splitbuttons are expected4993 spyOn(Ext.log, 'warn');4994 4995 var toolbar = Ext.create({4996 xtype: 'toolbar',4997 renderTo: document.body,4998 height: 75,4999 vertical: true,5000 overflowHandler: 'scroller',5001 items: [{5002 xtype: 'splitbutton',5003 arrowAlign: 'bottom',5004 text: '<div style="display:inline-block;width:86px;height:78px;background-color:red;"> </div>'5005 }, {5006 xtype: 'button',5007 arrowAlign: 'bottom',5008 menu: [],5009 text: '<div style="display:inline-block;width:86px;height:84px;background-color:red;"> </div>'5010 }]5011 });5012 expect(toolbar.items.getAt(0).getWidth()).toBe(100);5013 expect(toolbar.items.getAt(1).getWidth()).toBe(100);5014 toolbar.destroy();5015 });5016 TODO(Ext.isIE8).5017 it("should layout with overflowing text", function() {5018 button = Ext.create({5019 xtype: 'button',5020 renderTo: document.body,5021 text: '<div style="display:inline-block;width:142px;background:red;"> </div>',5022 menu: [],5023 width: 505024 });5025 expect(button).toHaveLayout({5026 el: {5027 w: 50,5028 h: 225029 },5030 btnWrap: {5031 x: 3,5032 y: 3,5033 w: 44,5034 h: 165035 },5036 btnInnerEl: {5037 x: 3,5038 y: 3,5039 w: 36,5040 h: 165041 }5042 });5043 });5044 }); // layout5045 describe("binding", function () {5046 it("should publish \"pressed\" state by default", function () {5047 makeButton({5048 viewModel : {5049 data: {5050 foo: false5051 }5052 },5053 enableToggle: true,5054 bind: {5055 pressed: '{foo}'5056 }5057 });5058 var vm = button.getViewModel();5059 button.setPressed(true);5060 vm.notify();5061 expect(vm.get('foo')).toBe(true);5062 button.setPressed(false);5063 vm.notify();5064 expect(vm.get('foo')).toBe(false);5065 });5066 it("should publish \"pressed\" state with reference", function () {5067 makeButton({5068 viewModel : true,5069 enableToggle: true,5070 reference: 'btn'5071 });5072 var vm = button.getViewModel();5073 button.setPressed(true);5074 vm.notify();5075 expect(vm.get('btn.pressed')).toBe(true);5076 button.setPressed(false);5077 vm.notify();5078 expect(vm.get('btn.pressed')).toBe(false);5079 });5080 describe("menu", function() {5081 var vm;5082 beforeEach(function() {5083 vm = new Ext.app.ViewModel({5084 data: {5085 title: 'someTitle',5086 text: 'otherText'5087 }5088 });5089 });5090 afterEach(function() {5091 vm = null;5092 });5093 it("should be able to bind properties higher up in the hierarchy", function() {5094 makeButton({5095 renderTo: Ext.getBody(),5096 text: 'Foo',5097 viewModel: vm,5098 menu: {5099 bind: {5100 title: '{title}'5101 },5102 items: {5103 bind: {5104 text: '{text}'5105 }5106 }5107 }5108 });5109 var menu = button.getMenu();5110 // Render it to trigger the bindings to initialize5111 menu.show();5112 vm.notify();5113 expect(menu.getTitle()).toBe('someTitle');5114 expect(menu.items.first().text).toBe('otherText');5115 });5116 it("should be able to bind when dynamically setting a menu", function() {5117 makeButton({5118 renderTo: Ext.getBody(),5119 text: 'Foo',5120 viewModel: vm5121 });5122 button.setMenu([{5123 bind: {5124 text: '{text}'5125 }5126 }]);5127 var menu = button.getMenu();5128 menu.show();5129 vm.notify();5130 expect(menu.items.first().text).toBe('otherText');5131 });5132 });5133 });5134 5135 describe("default ARIA attributes", function() {5136 beforeEach(function() {5137 makeButton({5138 renderTo: Ext.getBody()5139 });5140 });5141 5142 it("should not render aria-haspopup", function() {5143 expect(button).not.toHaveAttr('aria-haspopup');5144 });5145 5146 it("should not render aria-pressed", function() {5147 expect(button).not.toHaveAttr('aria-pressed');5148 });5149 });5150 5151 describe("tabIndex", function() {5152 describe("rendering", function() {5153 it("should render tabIndex when not disabled", function() {5154 createButton();5155 5156 expect(button).toHaveAttr('tabIndex', '0');5157 });5158 5159 it("should not render tabIndex when disabled", function() {5160 createButton({ disabled: true });5161 5162 expect(button).not.toHaveAttr('tabIndex');5163 });5164 });5165 5166 describe("disabling", function() {5167 beforeEach(function() {5168 createButton();5169 button.disable();5170 });5171 5172 it("should remove tabIndex when disabled", function() {5173 expect(button).not.toHaveAttr('tabIndex');5174 });5175 5176 it("should add tabIndex back when re-enabled", function() {5177 button.enable();5178 expect(button).toHaveAttr('tabIndex', '0');5179 });5180 });5181 });5182 5183 describe("click", function() {5184 beforeEach(function() {5185 makeButton({5186 renderTo: Ext.getBody()5187 });5188 });5189 5190 it("should allow event argument to be optional", function() {5191 expect(function() {5192 button.click();5193 }).not.toThrow();5194 });5195 });5196 5197 describe("toggle", function() {5198 beforeEach(function() {5199 makeButton({5200 renderTo: Ext.getBody(),5201 enableToggle: true5202 });5203 });5204 5205 describe("aria-pressed", function() {5206 describe("setup", function() {5207 it("should render", function() {5208 expect(button.ariaEl.dom.hasAttribute('aria-pressed')).toBe(true);5209 });5210 5211 it("should equal pressed state", function() {5212 expect(button).toHaveAttr('aria-pressed', 'false');5213 });5214 });5215 5216 describe("programmatic toggling", function() {5217 it("should be set to true when toggled", function() {5218 button.toggle();5219 5220 expect(button).toHaveAttr('aria-pressed', 'true');5221 });5222 5223 it("should be set to false when toggled back", function() {5224 button.toggle();5225 button.toggle();5226 5227 expect(button).toHaveAttr('aria-pressed', 'false');5228 });5229 });5230 5231 describe("clicking", function() {5232 it("should be set to true when clicked", function() {5233 clickIt();5234 5235 expect(button).toHaveAttr('aria-pressed', 'true');5236 });5237 5238 it("should be set to false when clicked twice", function() {5239 clickIt();5240 clickIt();5241 5242 expect(button).toHaveAttr('aria-pressed', 'false');5243 });5244 });5245 5246 describe("clicking with veto", function() {5247 beforeEach(function() {5248 button.addListener({5249 beforetoggle: function() {5250 return false;5251 }5252 });5253 });5254 it("should not be set to true when clicked", function() {5255 clickIt();5256 5257 expect(button).toHaveAttr('aria-pressed', 'false');5258 });5259 });5260 describe("keyboarding", function() {5261 it("should be set to true when Space key is pressed", function() {5262 jasmine.simulateKey(button, 'space');5263 5264 expect(button).toHaveAttr('aria-pressed', 'true');5265 });5266 5267 it("should be set to false when Space key is pressed twice", function() {5268 jasmine.simulateKey(button, 'space');5269 jasmine.simulateKey(button, 'space');5270 5271 expect(button).toHaveAttr('aria-pressed', 'false');5272 });5273 5274 it("should be set to true when Enter key is pressed", function() {5275 jasmine.simulateKey(button, 'enter');5276 5277 expect(button).toHaveAttr('aria-pressed', 'true');5278 });5279 5280 it("should be set to false when Enter key is pressed twice", function() {5281 jasmine.simulateKey(button, 'enter');5282 jasmine.simulateKey(button, 'enter');5283 5284 expect(button).toHaveAttr('aria-pressed', 'false');5285 });5286 });5287 describe("keyboarding with veto", function() {5288 beforeEach(function() {5289 button.addListener({5290 beforetoggle: function() {5291 return false;5292 }5293 });5294 });5295 it("should not be set to true when Space key is pressed", function() {5296 jasmine.simulateKey(button, 'space');5297 5298 expect(button).toHaveAttr('aria-pressed', 'false');5299 });5300 5301 it("should not be set to true when Enter key is pressed", function() {5302 jasmine.simulateKey(button, 'enter');5303 5304 expect(button).toHaveAttr('aria-pressed', 'false');5305 });5306 });5307 });5308 });5309 describe("disable/enable", function() {5310 describe("from parent", function() {5311 it("should remain disabled if configured as disabled and the parent is enabled", function() {5312 makeButton({5313 disabled: true5314 });5315 var ct = new Ext.container.Container({5316 renderTo: document.body,5317 items: button5318 });5319 ct.disable();5320 expect(button.el).toHaveCls(button._disabledCls);5321 expect(button.disabled).toBe(true);5322 ct.enable();5323 expect(button.el).toHaveCls(button._disabledCls);5324 expect(button.disabled).toBe(true);5325 ct.destroy();5326 });5327 });5328 });5329 5330 describe("keyboard interaction", function() {5331 var handlerSpy, enterSpy, downSpy;5332 5333 beforeEach(function() {5334 handlerSpy = jasmine.createSpy('button handler');5335 5336 makeButton({5337 text: 'foo',5338 handler: handlerSpy5339 });5340 5341 enterSpy = spyOn(button, 'onEnterKey').andCallThrough();5342 downSpy = spyOn(button, 'onDownKey').andCallThrough();5343 5344 button.render(Ext.getBody());5345 });5346 5347 afterEach(function() {5348 handlerSpy = enterSpy = downSpy = null;5349 });5350 5351 describe("Space key", function() {5352 beforeEach(function() {5353 jasmine.pressKey(button.el, 'space');5354 5355 waitForSpy(enterSpy);5356 });5357 5358 it("should have fired the handler", function() {5359 expect(handlerSpy).toHaveBeenCalled();5360 });5361 5362 it("should stop the keydown event", function() {5363 var args = enterSpy.mostRecentCall.args;5364 5365 expect(args[0].stopped).toBe(true);5366 });5367 5368 it("should return false to stop Event propagation loop", function() {5369 expect(enterSpy.mostRecentCall.result).toBe(false);5370 });5371 });5372 5373 describe("Enter key", function() {5374 beforeEach(function() {5375 jasmine.pressKey(button.el, 'enter');5376 5377 waitForSpy(enterSpy);5378 });5379 5380 it("should have fired the handler", function() {5381 expect(handlerSpy).toHaveBeenCalled();5382 });5383 5384 it("should stop the keydown event", function() {5385 var args = enterSpy.mostRecentCall.args;5386 5387 expect(args[0].stopped).toBe(true);5388 });5389 5390 it("should return false to stop Event propagation loop", function() {5391 expect(enterSpy.mostRecentCall.result).toBe(false);5392 });5393 });5394 5395 describe("Down key", function() {5396 beforeEach(function() {5397 jasmine.pressKey(button.el, 'down');5398 5399 waitForSpy(downSpy);5400 });5401 5402 it("should NOT have fired the handler", function() {5403 expect(handlerSpy).not.toHaveBeenCalled();5404 });5405 5406 it("should NOT stop the keydown event", function() {5407 var args = downSpy.mostRecentCall.args;5408 5409 expect(args[0].stopped).toBeFalsy();5410 });5411 5412 it("should NOT return false to stop Event propagation loop", function() {5413 expect(downSpy.mostRecentCall.result).not.toBeDefined();5414 });5415 });5416 });...
v3-pruning-variants.py
Source:v3-pruning-variants.py
...8from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run9BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benchmarks')10REVISIONS = ["issue707-v3"]11CONFIGS = [12 IssueConfig('rl-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),13 IssueConfig('dfp-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),14 IssueConfig('sccs-dfp-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),15 IssueConfig('rl-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),16 IssueConfig('dfp-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),17 IssueConfig('sccs-dfp-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),18 IssueConfig('rl-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false))']),19 IssueConfig('dfp-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false))']),20 IssueConfig('sccs-dfp-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_unreachable_states=false))']),21 IssueConfig('rl-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),22 IssueConfig('dfp-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),23 IssueConfig('sccs-dfp-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),24 IssueConfig('rl-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),25 IssueConfig('dfp-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),26 IssueConfig('sccs-dfp-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),27 IssueConfig('rl-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_irrelevant_states=false))']),28 IssueConfig('dfp-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_irrelevant_states=false))']),29 IssueConfig('sccs-dfp-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_irrelevant_states=false))']),30 IssueConfig('rl-b50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),31 IssueConfig('dfp-b50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),32 IssueConfig('sccs-dfp-b50k-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),33 IssueConfig('rl-ginf-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),34 IssueConfig('dfp-ginf-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),35 IssueConfig('sccs-dfp-ginf-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),36 IssueConfig('rl-f50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),37 IssueConfig('dfp-f50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),38 IssueConfig('sccs-dfp-f50k-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),39]40SUITE = DEFAULT_OPTIMAL_SUITE41ENVIRONMENT = MaiaEnvironment(42 priority=-100, email='silvan.sievers@unibas.ch')43if is_test_run():44 SUITE = ['depot:p01.pddl', 'depot:p02.pddl', 'parcprinter-opt11-strips:p01.pddl', 'parcprinter-opt11-strips:p02.pddl', 'mystery:prob07.pddl']45 ENVIRONMENT = LocalEnvironment(processes=4)46exp = IssueExperiment(47 revisions=REVISIONS,48 configs=CONFIGS,49 environment=ENVIRONMENT,50)51exp.add_resource('ms_parser', 'ms-parser.py', dest='ms-parser.py')52exp.add_command('ms-parser', ['{ms_parser}'])...
v4-pruning-variants.py
Source:v4-pruning-variants.py
...6from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run7BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benchmarks')8REVISIONS = ["issue707-v4"]9CONFIGS = [10 IssueConfig('rl-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),11 IssueConfig('dfp-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),12 IssueConfig('sccs-dfp-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),13 IssueConfig('rl-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),14 IssueConfig('dfp-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),15 IssueConfig('sccs-dfp-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),16 IssueConfig('rl-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false))']),17 IssueConfig('dfp-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false))']),18 IssueConfig('sccs-dfp-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_unreachable_states=false))']),19 IssueConfig('rl-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),20 IssueConfig('dfp-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),21 IssueConfig('sccs-dfp-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),22 IssueConfig('rl-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),23 IssueConfig('dfp-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),24 IssueConfig('sccs-dfp-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),25 IssueConfig('rl-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_irrelevant_states=false))']),26 IssueConfig('dfp-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_irrelevant_states=false))']),27 IssueConfig('sccs-dfp-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_irrelevant_states=false))']),28 IssueConfig('rl-b50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),29 IssueConfig('dfp-b50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),30 IssueConfig('sccs-dfp-b50k-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),31 IssueConfig('rl-ginf-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),32 IssueConfig('dfp-ginf-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),33 IssueConfig('sccs-dfp-ginf-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),34 IssueConfig('rl-f50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),35 IssueConfig('dfp-f50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),36 IssueConfig('sccs-dfp-f50k-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),37]38SUITE = DEFAULT_OPTIMAL_SUITE39ENVIRONMENT = MaiaEnvironment(40 priority=0, email='silvan.sievers@unibas.ch')41if is_test_run():42 SUITE = ['depot:p01.pddl', 'depot:p02.pddl', 'parcprinter-opt11-strips:p01.pddl', 'parcprinter-opt11-strips:p02.pddl', 'mystery:prob07.pddl']43 ENVIRONMENT = LocalEnvironment(processes=4)44exp = IssueExperiment(45 revisions=REVISIONS,46 configs=CONFIGS,47 environment=ENVIRONMENT,48)49exp.add_resource('ms_parser', 'ms-parser.py', dest='ms-parser.py')50exp.add_command('ms-parser', ['{ms_parser}'])...
v5-pruning-variants.py
Source:v5-pruning-variants.py
...6from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run7BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benchmarks')8REVISIONS = ["issue707-v5"]9CONFIGS = [10 IssueConfig('rl-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),11 IssueConfig('dfp-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),12 IssueConfig('sccs-dfp-b50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false))']),13 IssueConfig('rl-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),14 IssueConfig('dfp-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),15 IssueConfig('sccs-dfp-ginf-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false))']),16 IssueConfig('rl-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false))']),17 IssueConfig('dfp-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false))']),18 IssueConfig('sccs-dfp-f50k-nopruneunreachable', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_unreachable_states=false))']),19 IssueConfig('rl-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),20 IssueConfig('dfp-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),21 IssueConfig('sccs-dfp-b50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_irrelevant_states=false))']),22 IssueConfig('rl-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),23 IssueConfig('dfp-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),24 IssueConfig('sccs-dfp-ginf-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_irrelevant_states=false))']),25 IssueConfig('rl-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_irrelevant_states=false))']),26 IssueConfig('dfp-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_irrelevant_states=false))']),27 IssueConfig('sccs-dfp-f50k-nopruneirrelevant', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_irrelevant_states=false))']),28 IssueConfig('rl-b50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),29 IssueConfig('dfp-b50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=false),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),30 IssueConfig('sccs-dfp-b50k-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=false),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),31 IssueConfig('rl-ginf-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),32 IssueConfig('dfp-ginf-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_bisimulation(greedy=true),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),33 IssueConfig('sccs-dfp-ginf-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_bisimulation(greedy=true),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=infinity,threshold_before_merge=1,prune_unreachable_states=false,prune_irrelevant_states=false))']),34 IssueConfig('rl-f50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level)),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),35 IssueConfig('dfp-f50k-noprune', ['--search', 'astar(merge_and_shrink(merge_strategy=merge_stateless(merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order])),shrink_strategy=shrink_fh(),label_reduction=exact(before_shrinking=false,before_merging=true),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),36 IssueConfig('sccs-dfp-f50k-noprune', ['--search', 'astar(merge_and_shrink(shrink_strategy=shrink_fh(),merge_strategy=merge_sccs(order_of_sccs=topological,merge_selector=score_based_filtering(scoring_functions=[goal_relevance,dfp,total_order(atomic_ts_order=reverse_level,product_ts_order=new_to_old,atomic_before_product=false)])),label_reduction=exact(before_shrinking=true,before_merging=false),max_states=50000,prune_unreachable_states=false,prune_irrelevant_states=false))']),37]38SUITE = DEFAULT_OPTIMAL_SUITE39ENVIRONMENT = MaiaEnvironment(40 priority=0, email='silvan.sievers@unibas.ch')41if is_test_run():42 SUITE = ['depot:p01.pddl', 'depot:p02.pddl', 'parcprinter-opt11-strips:p01.pddl', 'parcprinter-opt11-strips:p02.pddl', 'mystery:prob07.pddl']43 ENVIRONMENT = LocalEnvironment(processes=4)44exp = IssueExperiment(45 revisions=REVISIONS,46 configs=CONFIGS,47 environment=ENVIRONMENT,48)49exp.add_resource('ms_parser', 'ms-parser.py', dest='ms-parser.py')50exp.add_command('ms-parser', ['{ms_parser}'])...
she-header.js
Source:she-header.js
1var $j = jQuery.noConflict();2$j(document).ready(function () {3 "use strict";4 // She header5 sheHeader();6});7/* ==============================================8HEADER EFFECTS9============================================== */10function sheHeader() {11 var header = $j('.she-header-yes'),12 container = $j('.she-header-yes .elementor-container'),13 header_elementor = $j('.elementor-edit-mode .she-header-yes'),14 header_logo = $j('.she-header-yes .elementor-widget-theme-site-logo img, .she-header-yes .elementor-widget-image img'),15 data_settings = header.data('settings');16 if (typeof data_settings != 'undefined') {17 var responsive_settings = data_settings["transparent_on"];18 var width = $j(window).width(),19 header_height = header.height(),20 logo_width = header_logo.width(),21 logo_height = header_logo.height();22 }23 // Check responsive is enabled24 if (typeof width != 'undefined' && width) {25 if (width >= 1025) {26 var enabled = "desktop";27 } else if (width > 767 && width < 1025) {28 var enabled = "tablet";29 } else if (width <= 767) {30 var enabled = "mobile";31 }32 }33 console.log($j.inArray(enabled, responsive_settings));34 if ($j.inArray(enabled, responsive_settings) != '-1') {35 var scroll_distance = data_settings["scroll_distance"];36 var transparent_header = data_settings["transparent_header_show"];37 var background = data_settings["background"];38 var bottom_border_color = data_settings["custom_bottom_border_color"],39 bottom_border_view = data_settings["bottom_border"],40 bottom_border_width = data_settings["custom_bottom_border_width"];41 var shrink_header = data_settings["shrink_header"],42 data_height = data_settings["custom_height_header"],43 data_height_tablet = data_settings["custom_height_header_tablet"],44 data_height_mobile = data_settings["custom_height_header_mobile"];45 var shrink_logo = data_settings["shrink_header_logo"],46 data_logo_height = data_settings["custom_height_header_logo"],47 data_logo_height_tablet = data_settings["custom_height_header_logo_tablet"],48 data_logo_height_mobile = data_settings["custom_height_header_logo_mobile"];49 var change_logo_color = data_settings["change_logo_color"];50 var blur_bg = data_settings["blur_bg"];51 var scroll_distance_hide_header = data_settings["scroll_distance_hide_header"];52 // add transparent class53 if (transparent_header == "yes") {54 header.addClass('she-header-transparent-yes');55 }56 // header height shrink57 if (typeof data_height != 'undefined' && data_height) {58 if (width >= 1025) {59 var shrink_height = data_height["size"];60 } else if (width > 767 && width < 1025) {61 var shrink_height = data_height_tablet["size"];62 if (shrink_height == '') {63 shrink_height = data_height["size"];64 }65 } else if (width <= 767) {66 var shrink_height = data_height_mobile["size"];67 if (shrink_height == '') {68 shrink_height = data_height["size"];69 }70 }71 }72 // logo height shrink73 if (typeof data_logo_height != 'undefined' && data_logo_height) {74 if (width >= 1025) {75 var shrink_logo_height = data_logo_height["size"];76 if (shrink_logo_height == '') {77 shrink_logo_height = shrink_height;78 var percent = parseInt(shrink_logo_height) / parseInt(header_height),79 width = logo_width * percent,80 height = logo_height * percent;81 } else {82 width = logo_width * shrink_logo_height / 100,83 height = logo_height * shrink_logo_height / 100;84 }85 } else if (width > 767 && width < 1025) {86 var shrink_logo_height = data_logo_height_tablet["size"];87 if (shrink_logo_height == '') {88 shrink_logo_height = data_logo_height["size"];89 if (shrink_logo_height == '') {90 shrink_logo_height = shrink_height;91 var percent = parseInt(shrink_logo_height) / parseInt(header_height),92 width = logo_width * percent,93 height = logo_height * percent;94 } else {95 width = logo_width * shrink_logo_height / 100,96 height = logo_height * shrink_logo_height / 100;97 }98 }99 } else if (width <= 767) {100 var shrink_logo_height = data_logo_height_mobile["size"];101 if (shrink_logo_height == '') {102 shrink_logo_height = data_logo_height["size"];103 if (shrink_logo_height == '') {104 shrink_logo_height = shrink_height;105 var percent = parseInt(shrink_logo_height) / parseInt(header_height),106 width = logo_width * percent,107 height = logo_height * percent;108 } else {109 width = logo_width * shrink_logo_height / 100,110 height = logo_height * shrink_logo_height / 100;111 }112 }113 }114 }115 // border bottom116 if (typeof bottom_border_width != 'undefined' && bottom_border_width) {117 var bottom_border = bottom_border_width["size"] + "px solid " + bottom_border_color;118 }119 // hide header on scroll120 if (typeof scroll_distance_hide_header != 'undefined' && scroll_distance_hide_header) {121 var mywindow = $j(window);122 var mypos = mywindow.scrollTop();123 mywindow.scroll(function () {124 if (mypos > scroll_distance_hide_header["size"]) {125 if (mywindow.scrollTop() > mypos) {126 header.addClass('headerup');127 } else {128 header.removeClass('headerup');129 }130 }131 mypos = mywindow.scrollTop();132 });133 }134 // scroll function135 $j(window).on("load scroll", function (e) {136 var scroll = $j(window).scrollTop();137 if (header_elementor) {138 header_elementor.css("position", "relative");139 }140 if (scroll >= scroll_distance["size"]) {141 header.removeClass('header').addClass("she-header");142 header.css("background-color", background);143 header.css("border-bottom", bottom_border);144 header.removeClass('she-header-transparent-yes');145 if (shrink_header == "yes") {146 header.css({ "padding-top": "0", "padding-bottom": "0", "margin-top": "0", "margin-bottom": "0" });147 container.css({ "min-height": shrink_height, "transition": "all 0.4s ease-in-out", "-webkit-transition": "all 0.4s ease-in-out", "-moz-transition": "all 0.4s ease-in-out" });148 }149 if (shrink_logo == "yes") {150 header_logo.css({ "width": width, "transition": "all 0.4s ease-in-out", "-webkit-transition": "all 0.4s ease-in-out", "-moz-transition": "all 0.4s ease-in-out" });151 }152 if (change_logo_color == "yes") {153 header_logo.addClass("change-logo-color");154 }155 if (blur_bg == "yes") {156 header.css({ "backdrop-filter": "saturate(180%) blur(20px)", "-webkit-backdrop-filter": "saturate(180%) blur(20px)" });157 }158 } else {159 header.removeClass("she-header").addClass('header');160 header.css("background-color", "");161 header.css("border-bottom", "");162 if (transparent_header == "yes") {163 header.addClass('she-header-transparent-yes');164 }165 if (shrink_header == "yes") {166 header.css({ "padding-top": "", "padding-bottom": "", "margin-top": "", "margin-bottom": "" });167 container.css("min-height", "");168 }169 if (shrink_logo == "yes") {170 header_logo.css({ "height": "", "width": "" });171 }172 if (change_logo_color == "yes") {173 header_logo.removeClass("change-logo-color");174 }175 if (blur_bg == "yes") {176 header.css({ "backdrop-filter": "", "-webkit-backdrop-filter": "" });177 }178 }179 });180 }...
Using AI Code Generation
1const fc = require("fast-check");2const { shrink } = require("fast-check/lib/arbitrary/Shrink");3const { integer } = require("fast-check/lib/arbitrary/IntegerArbitrary");4const { array } = require("fast-check/lib/arbitrary/ArrayArbitrary");5const { tuple } = require("fast-check/lib/arbitrary/TupleArbitrary");6const { record } = require("fast-check/lib/arbitrary/RecordArbitrary");7const { dictionary } = require("fast-check/lib/arbitrary/DictionaryArbitrary");8const { option } = require("fast-check/lib/arbitrary/OptionArbitrary");9const { constantFrom } = require("fast-check/lib/arbitrary/ConstantFromArbitrary");10const { oneof } = require("fast-check/lib/arbitrary/OneOfArbitrary");11const { set } = require("fast-check/lib/arbitrary/SetArbitrary");12const { stringOf } = require("fast-check/lib/arbitrary/StringArbitrary");13const { map } = require("fast-check/lib/arbitrary/MapArbitrary");14const { unicodeString } = require("fast-check/lib/arbitrary/UnicodeStringArbitrary");15const { date } = require("fast-check/lib/arbitrary/DateArbitrary");16const { double } = require("fast-check/lib/arbitrary/DoubleArbitrary");17const { float } = require("fast-check/lib/arbitrary/FloatArbitrary");18const { bigInt } = require("fast-check/lib/arbitrary/BigIntArbitrary");19const { bigUintN } = require("fast-check/lib/arbitrary/BigUintNArbitrary");20const { bigIntN } = require("fast-check/lib/arbitrary/BigIntNArbitrary");21const { byte } = require("fast-check/lib/arbitrary/ByteArbitrary");22const { char } = require("fast-check/lib/arbitrary/CharArbitrary");23const { fullUnicode } = require("fast-check/lib/arbitrary/FullUnicodeArbitrary");24const { hexa } = require("fast-check/lib/arbitrary/HexaArbitrary");25const { hexaString } = require("fast-check/lib/arbitrary/HexaStringArbitrary");26const { maxSafeInteger } = require("fast-check/lib/arbitrary/MaxSafeIntegerArbitrary");27const { minSafeInteger } = require("fast-check/lib/arbitrary/MinSafeIntegerArbitrary");28const { nat } = require("fast-check/lib/arbitrary/NatArbitrary");29const { unicode }
Using AI Code Generation
1const { shrink } = require("fast-check");2console.log(shrink(1, 2));3const { shrink } = require("fast-check");4console.log(shrink(1, 2));5 at Object. (/Users/username/Desktop/test4.js:4:15)6 at Module._compile (internal/modules/cjs/loader.js:1200:30)7 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)8 at Module.load (internal/modules/cjs/loader.js:1049:32)9 at Function.Module._load (internal/modules/cjs/loader.js:937:14)10 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
Using AI Code Generation
1const { shrink } = require("fast-check-monorepo");2const { shrink } = require("fast-check-monorepo");3const shrink = require("fast-check-monorepo").shrink;4const { shrink } = require("fast-check-monorepo");5const { shrink } = require("fast-check-monorepo");6const { shrink } = require("fast-check-monorepo");7const { shrink } = require("fast-check-monorepo");8const { shrink } = require("fast-check-monorepo");9const { shrink } = require("fast-check-monorepo");10const { shrink } = require("fast-check-monorepo");11const { shrink } = require("fast-check-monorepo");12const { shrink } = require("fast-check-monorepo");13const { shrink } = require("fast-check-monorepo");14const { shrink } = require("fast-check-monorepo");15const { shrink } = require("fast-check-monorepo");16const { shrink } = require("fast-check-monorepo");17const { shrink } = require("fast-check
Using AI Code Generation
1const { shrink } = require('fast-check-monorepo');2const { fc } = require('fast-check');3const arb = fc.integer({ min: 0, max: 100 });4const shrinked = shrink(arb, 101);5console.log(shrinked);6const { shrink } = require('fast-check');7const { fc } = require('fast-check');8const arb = fc.integer({ min: 0, max: 100 });9const shrinked = shrink(arb, 101);10console.log(shrinked);11const { shrink } = require('fast-check-monorepo');12const { fc } = require('fast-check');13const arb = fc.integer({ min: 0, max: 100 });14const shrinked = shrink(arb, 101);15console.log(shrinked);16const { shrink } = require('fast-check');17const { fc } = require('fast-check');18const arb = fc.integer({ min: 0, max: 100 });19const shrinked = shrink(arb, 101);20console.log(shrinked);21const { shrink } = require('fast-check-monorepo');22const { fc } = require('fast-check');23const arb = fc.integer({ min: 0, max: 100 });24const shrinked = shrink(arb, 101);25console.log(shrinked);26const { shrink } = require('fast-check');27const { fc } = require('
Using AI Code Generation
1const fc = require("fast-check");2const { shrink } = require("fast-check-monorepo");3const shrinkString = shrink.string;4const shrinkStringWithLength = shrinkString.withLength(4);5const shrinkStringWithLengthAndMaxLength = shrinkString.withLength(4).withMaxLength(10);6const shrinkStringWithLengthAndMaxLengthAndFullString = shrinkString.withLength(4).withMaxLength(10).withFullString();7const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncation = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation();8const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncationAndNoBase = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation().noBase();9const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncationAndNoBaseAndNoString = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation().noBase().noString();10const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncationAndNoBaseAndNoStringAndNoChar = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation().noBase().noString().noChar();11const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncationAndNoBaseAndNoStringAndNoCharAndNoIndex = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation().noBase().noString().noChar().noIndex();12const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncationAndNoBaseAndNoStringAndNoCharAndNoIndexAndNoCharInString = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation().noBase().noString().noChar().noIndex().noCharInString();13const shrinkStringWithLengthAndMaxLengthAndFullStringAndNoTruncationAndNoBaseAndNoStringAndNoCharAndNoIndexAndNoCharInStringAndNoBaseInString = shrinkString.withLength(4).withMaxLength(10).withFullString().noTruncation().noBase().noString().noChar().noIndex().noCharInString().noBaseInString();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!