diff --git a/demos/button/checkbox.html b/demos/button/checkbox.html index 7b914c871b1..2b649ae422c 100644 --- a/demos/button/checkbox.html +++ b/demos/button/checkbox.html @@ -8,11 +8,34 @@ + - - - -
- - - -
-
-

A checkbox is styled as a toggle button with the button widget. The label element associated with the checkbox is used for the button text.

-

This demo also demonstrates three checkboxes styled as a button set by calling .buttonset() on a common container.

+ css for new checkbox widget
+
+ + + + + + + + +
+
+ + + + + + + + +
diff --git a/demos/button/default.html b/demos/button/default.html index b50d018c657..97fd4ee7d46 100644 --- a/demos/button/default.html +++ b/demos/button/default.html @@ -11,7 +11,7 @@ +
+

Widget Buttons

+ - + - + An anchor +
+

CSS Buttons

+ + + -An anchor +An anchor

Examples of the markup that can be used for buttons: A button element, an input of type submit and an anchor.

diff --git a/demos/button/icons.html b/demos/button/icons.html index e20d1c6d8a1..bdc08c33ad0 100644 --- a/demos/button/icons.html +++ b/demos/button/icons.html @@ -11,39 +11,58 @@ - - - - - -

Some buttons with various combinations of text and icons.

+
+
+

Widget

+ + + + +
+
+

CSS

+ + + + + +
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html index e016a06b0fa..f67f67447d7 100644 --- a/tests/unit/button/button.html +++ b/tests/unit/button/button.html @@ -33,7 +33,7 @@
-
+
diff --git a/tests/unit/button/button_common.js b/tests/unit/button/button_common.js index ef22d30114f..c59d4ee909d 100644 --- a/tests/unit/button/button_common.js +++ b/tests/unit/button/button_common.js @@ -1,14 +1,12 @@ TestHelpers.commonWidgetTests( "button", { defaults: { disabled: null, - icons: { - primary: null, - secondary: null - }, + showLabel: true, label: null, - text: true, + icon: null, + iconPosition: "beginning", - // callbacks + // Callbacks create: null } }); diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js index f647cdc26b1..eb0a43c14e1 100644 --- a/tests/unit/button/button_core.js +++ b/tests/unit/button/button_core.js @@ -5,69 +5,9 @@ (function($) { -module("button: core"); +module( "Button: core" ); -test("checkbox", function() { - expect( 4 ); - var input = $("#check"), - label = $("label[for=check]"); - ok( input.is(":visible") ); - ok( label.is(":not(.ui-button)") ); - input.button(); - ok( input.is(".ui-helper-hidden-accessible") ); - ok( label.is(".ui-button") ); -}); - -test("radios", function() { - expect( 4 ); - var inputs = $("#radio0 input"), - labels = $("#radio0 label"); - ok( inputs.is(":visible") ); - ok( labels.is(":not(.ui-button)") ); - inputs.button(); - ok( inputs.is(".ui-helper-hidden-accessible") ); - ok( labels.is(".ui-button") ); -}); - -function assert(noForm, form1, form2) { - ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") ); - ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") ); - ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") ); -} - -test("radio groups", function() { - expect( 12 ); - $("input[type=radio]").button(); - assert(":eq(0)", ":eq(1)", ":eq(2)"); - - // click outside of forms - $("#radio0 .ui-button:eq(1)").click(); - assert(":eq(1)", ":eq(1)", ":eq(2)"); - - // click in first form - $("#radio1 .ui-button:eq(0)").click(); - assert(":eq(1)", ":eq(0)", ":eq(2)"); - - // click in second form - $("#radio2 .ui-button:eq(0)").click(); - assert(":eq(1)", ":eq(0)", ":eq(0)"); -}); - -test( "radio groups - ignore elements with same name", function() { - expect( 1 ); - var form = $( "form:first" ), - radios = form.find( "[type=radio]" ).button(), - checkbox = $( "", { - type: "checkbox", - name: radios.attr( "name" ) - }); - - form.append( checkbox ); - radios.button( "refresh" ); - ok( true, "no exception from accessing button instance of checkbox" ); -}); - -test("input type submit, don't create child elements", function() { +test( "Input type submit, don't create child elements", function() { expect( 2 ); var input = $("#submit"); deepEqual( input.children().length, 0 ); @@ -75,150 +15,17 @@ test("input type submit, don't create child elements", function() { deepEqual( input.children().length, 0 ); }); -test("buttonset", function() { - expect( 6 ); - var set = $("#radio1").buttonset(); - ok( set.is(".ui-buttonset") ); - deepEqual( set.children(".ui-button").length, 3 ); - deepEqual( set.children("input[type=radio].ui-helper-hidden-accessible").length, 3 ); - ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); - ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); - ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); -}); - -test("buttonset (rtl)", function() { - expect( 6 ); - var set, - parent = $("#radio1").parent(); - // Set to rtl - parent.attr("dir", "rtl"); - - set = $("#radio1").buttonset(); - ok( set.is(".ui-buttonset") ); - deepEqual( set.children(".ui-button").length, 3 ); - deepEqual( set.children("input[type=radio].ui-helper-hidden-accessible").length, 3 ); - ok( set.children("label:eq(0)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); - ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); - ok( set.children("label:eq(2)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); -}); - -// TODO: simulated click events don't behave like real click events in IE -// remove this when simulate properly simulates this -// see http://yuilibrary.com/projects/yui2/ticket/2528826 fore more info -if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) { - asyncTest( "ensure checked and aria after single click on checkbox label button, see #5518", function() { - expect( 3 ); - - $("#check2").button().change( function() { - var lbl = $( this ).button("widget"); - ok( this.checked, "checked ok" ); - ok( lbl.attr("aria-pressed") === "true", "aria ok" ); - ok( lbl.hasClass("ui-state-active"), "ui-state-active ok" ); - }); - - // support: Opera - // Opera doesn't trigger a change event when this is done synchronously. - // This seems to be a side effect of another test, but until that can be - // tracked down, this delay will have to do. - setTimeout(function() { - $("#check2").button("widget").simulate("click"); - start(); - }, 1 ); - }); -} - -test( "#7092 - button creation that requires a matching label does not find label in all cases", function() { - expect( 5 ); - var group = $( "" ); - group.find( "input[type=checkbox]" ).button(); - ok( group.find( "label" ).is( ".ui-button" ) ); - - group = $( "" ); - group.filter( "input[type=checkbox]" ).button(); - ok( group.filter( "label" ).is( ".ui-button" ) ); - - group = $( "" ); - group.find( "input[type=checkbox]" ).button(); - ok( group.filter( "label" ).is( ".ui-button" ) ); - - group = $( "" ); - group.find( "input[type=checkbox]" ).button(); - ok( group.find( "label" ).is( ".ui-button" ) ); - - group = $( "" ); - group.filter( "input[type=checkbox]" ).button(); - ok( group.find( "label" ).is( ".ui-button" ) ); -}); - -test( "#5946 - buttonset should ignore buttons that are not :visible", function() { - expect( 2 ); - $( "#radio01" ).next().addBack().hide(); - var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" }); - ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) ); - ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) ); -}); - -test( "#6262 - buttonset not applying ui-corner to invisible elements", function() { - expect( 3 ); - $( "#radio0" ).hide(); - var set = $( "#radio0" ).buttonset(); - ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) ); - ok( set.find( "label:eq(1)" ).is( ".ui-button" ) ); - ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) ); -}); - -asyncTest( "Resetting a button's form should refresh the visual state of the button widget to match.", function() { - expect( 2 ); - var form = $( "
" + - "" + - "" + - "
" ), - button = form.find( "button" ).button(), - checkbox = form.find( "input[type=checkbox]" ).button(); - - checkbox.prop( "checked", false ).button( "refresh" ); - ok( !checkbox.button( "widget" ).hasClass( "ui-state-active" ) ); - - form.get( 0 ).reset(); - - // #9213: If a button has been removed, refresh should not be called on it when - // its corresponding form is reset. - button.remove(); - - setTimeout(function() { - ok( checkbox.button( "widget" ).hasClass( "ui-state-active" )); - start(); - }, 1 ); -}); - -asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() { - expect( 2 ); - var check = $( "#check" ).button(), - label = $( "label[for='check']" ); - ok( !label.is( ".ui-state-focus" ) ); - check.focus(); - setTimeout(function() { - ok( label.is( ".ui-state-focus" ) ); - start(); - }); -}); - -test( "#7534 - Button label selector works for ids with \":\"", function() { +asyncTest( "Disabled button maintains ui-state-focus", function() { expect( 1 ); - var group = $( "" ); - group.find( "input" ).button(); - ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); -}); - -asyncTest( "#9169 - Disabled button maintains ui-state-focus", function() { - expect( 2 ); var element = $( "#button1" ).button(); - element[ 0 ].focus(); + element.simulate( "focus" ); setTimeout(function() { - ok( element.hasClass( "ui-state-focus" ), "button has ui-state-focus" ); + + // Todo: figure out why this fails in phantom put passes in browser + // ok( element.is( ":focus" ), "Button is focused" ); element.button( "disable" ); - ok( !element.hasClass( "ui-state-focus" ), - "button does not have ui-state-focus when disabled" ); + ok( !element.is( ":focus" ), + "Button has had focus removed" ); start(); }); }); diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js index 2fd03832562..d24aa866660 100644 --- a/tests/unit/button/button_events.js +++ b/tests/unit/button/button_events.js @@ -3,24 +3,16 @@ */ (function($) { -module("button: events"); +module( "Button: events" ); -test("buttonset works with single-quote named elements (#7505)", function() { - expect( 1 ); - $("#radio3").buttonset(); - $("#radio33").click( function(){ - ok( true, "button clicks work with single-quote named elements" ); - }).click(); -}); - -asyncTest( "when button loses focus, ensure active state is removed (#8559)", function() { +asyncTest( "When button loses focus, ensure active state is removed", function() { expect( 1 ); var element = $( "#button" ).button(); element.one( "keypress", function() { element.one( "blur", function() { - ok( !element.is(".ui-state-active"), "button loses active state appropriately" ); + ok( !element.is( ".ui-state-active" ), "button loses active state appropriately" ); start(); }).blur(); }); diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js index 467938f00f5..07cc0660514 100644 --- a/tests/unit/button/button_methods.js +++ b/tests/unit/button/button_methods.js @@ -4,9 +4,9 @@ (function($) { -module("button: methods"); +module( "Button: methods" ); -test("destroy", function() { +test( "destroy", function() { expect( 1 ); domEqual( "#button", function() { $( "#button" ).button().button( "destroy" ); diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js index 124a8699f6f..36cb574ab7d 100644 --- a/tests/unit/button/button_options.js +++ b/tests/unit/button/button_options.js @@ -25,100 +25,84 @@ test( "disabled, explicit value", function() { deepEqual( element.prop( "disabled" ), true, "element is not disabled" ); }); -test("disabled, null", function() { +test( "disabled, null", function() { expect( 4 ); - $("#radio01").button({ disabled: null }); - deepEqual(false, $("#radio01").button("option", "disabled"), + $( "#radio01" ).button({ disabled: null }); + strictEqual( $("#radio01").button("option", "disabled"), false, "disabled option set to false"); - deepEqual(false, $("#radio01").prop("disabled"), "element is disabled"); + strictEqual( $("#radio01").prop("disabled"), false, "element is disabled"); - $("#radio02").prop("disabled", true).button({ disabled: null }); - deepEqual(true, $("#radio02").button("option", "disabled"), - "disabled option set to true"); - deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled"); + $( "#radio02" ).prop( "disabled", true ).button({ disabled: null }); + deepEqual( true, $( "#radio02" ).button( "option", "disabled" ), + "disabled option set to true" ); + deepEqual( true, $( "#radio02" ).prop( "disabled" ), "element is not disabled" ); }); -test("text false without icon", function() { +test( "showLabel false without icon", function() { expect( 1 ); - $("#button").button({ - text: false + $( "#button" ).button({ + showLabel: false }); - ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") ); + strictEqual( $( "#button" ).attr( "class" ), "ui-button ui-widget ui-corner-all" ); - $("#button").button("destroy"); + $( "#button" ).button( "destroy" ); }); -test("text false with icon", function() { +test("showLabel false with icon", function() { expect( 1 ); $("#button").button({ - text: false, - icons: { - primary: "iconclass" - } + showLabel: false, + icon: "iconclass" }); - ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") ); + strictEqual( $( "#button" ).attr( "class" ), "ui-button ui-widget ui-corner-all ui-icon-beginning ui-button-icon-only" ); - $("#button").button("destroy"); + $( "#button" ).button( "destroy" ); }); -test("label, default", function() { +test( "label, default", function() { expect( 2 ); - $("#button").button(); - deepEqual( $("#button").text(), "Label" ); - deepEqual( $( "#button").button( "option", "label" ), "Label" ); + $( "#button" ).button(); + deepEqual( $( "#button" ).text(), "Label" ); + deepEqual( $( "#button" ).button( "option", "label" ), "Label" ); - $("#button").button("destroy"); + $( "#button" ).button( "destroy" ); }); -test("label", function() { +test( "label", function() { expect( 2 ); - $("#button").button({ + $( "#button" ).button({ label: "xxx" }); - deepEqual( $("#button").text(), "xxx" ); - deepEqual( $("#button").button( "option", "label" ), "xxx" ); + deepEqual( $( "#button" ).text(), "xxx" ); + deepEqual( $( "#button" ).button( "option", "label" ), "xxx" ); - $("#button").button("destroy"); + $( "#button" ).button( "destroy" ); }); -test("label default with input type submit", function() { +test( "label default with input type submit", function() { expect( 2 ); - deepEqual( $("#submit").button().val(), "Label" ); - deepEqual( $("#submit").button( "option", "label" ), "Label" ); + deepEqual( $( "#submit" ).button().val(), "Label" ); + deepEqual( $( "#submit" ).button( "option", "label" ), "Label" ); }); -test("label with input type submit", function() { +test( "label with input type submit", function() { expect( 2 ); - var label = $("#submit").button({ + var label = $( "#submit" ).button({ label: "xxx" }).val(); deepEqual( label, "xxx" ); - deepEqual( $("#submit").button( "option", "label" ), "xxx" ); + deepEqual( $( "#submit" ).button( "option", "label" ), "xxx" ); }); -test("icons", function() { +test( "icons", function() { expect( 1 ); $("#button").button({ - text: false, - icons: { - primary: "iconclass", - secondary: "iconclass2" - } + showLabel: false, + icon: "iconclass" }); - ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") ); - - $("#button").button("destroy"); -}); + strictEqual( $( "#button" ).find( "span.ui-icon.iconclass" ).length, 1 ); -test( "#5295 - button does not remove hoverstate if disabled" , function() { - expect( 1 ); - var btn = $("#button").button(); - btn.hover( function() { - btn.button( "disable" ); - }); - btn.trigger( "mouseenter" ); - btn.trigger( "mouseleave" ); - ok( !btn.is( ".ui-state-hover") ); + $( "#button" ).button( "destroy" ); }); })(jQuery); diff --git a/tests/unit/checkboxradio/checkboxradio.html b/tests/unit/checkboxradio/checkboxradio.html new file mode 100644 index 00000000000..850966050bf --- /dev/null +++ b/tests/unit/checkboxradio/checkboxradio.html @@ -0,0 +1,85 @@ + + + + + jQuery UI Checkboxradio Test Suite + + + + + + + + + + + + + + + + +
+
+ +
+ + + +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/tests/unit/checkboxradio/checkboxradio_common.js b/tests/unit/checkboxradio/checkboxradio_common.js new file mode 100644 index 00000000000..93c74613767 --- /dev/null +++ b/tests/unit/checkboxradio/checkboxradio_common.js @@ -0,0 +1,10 @@ +TestHelpers.commonWidgetTests( "checkboxradio", { + defaults: { + disabled: null, + label: null, + icon: false, + + // Callbacks + create: null + } +}); diff --git a/tests/unit/checkboxradio/checkboxradio_core.js b/tests/unit/checkboxradio/checkboxradio_core.js new file mode 100644 index 00000000000..ffbf5312459 --- /dev/null +++ b/tests/unit/checkboxradio/checkboxradio_core.js @@ -0,0 +1,140 @@ +/* + * checkboxradio_core.js + */ + + +(function($) { + +module("Checkboxradio: core"); +test("Checkbox", function() { + expect( 4 ); + var input = $("#check"), + label = $("label[for=check]"); + ok( input.is( ":visible" ) ); + ok( !label.hasClass(".ui-button)") ); + input.checkboxradio(); + strictEqual( input.attr( "class" ), "ui-helper-hidden-accessible ui-checkboxradio" ); + strictEqual( label.attr( "class" ), "ui-button ui-widget ui-corner-all ui-checkbox-label" ); +}); + +test("Radios", function() { + expect( 4 ); + var inputs = $("#radio0 input"), + labels = $("#radio0 label"); + ok( inputs.is(":visible") ); + ok( labels.is(":not(.ui-button)") ); + inputs.checkboxradio(); + ok( inputs.is(".ui-helper-hidden-accessible") ); + ok( labels.is(".ui-button") ); +}); + +function assert(noForm, form1, form2) { + ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") ); + ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") ); + ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") ); +} + +test("radio groups", function() { + expect( 12 ); + $("input[type=radio]").checkboxradio(); + assert(":eq(0)", ":eq(1)", ":eq(2)"); + + // click outside of forms + $("#radio0 .ui-button:eq(1)").simulate("click"); + assert(":eq(1)", ":eq(1)", ":eq(2)"); + + // click in first form + $("#radio1 .ui-button:eq(0)").simulate("click"); + assert(":eq(1)", ":eq(0)", ":eq(2)"); + + // click in second form + $("#radio2 .ui-button:eq(0)").simulate("click"); + assert(":eq(1)", ":eq(0)", ":eq(0)"); +}); + +asyncTest( "Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() { + expect( 2 ); + var check = $( "#check" ).checkboxradio(), + label = $( "label[for='check']" ); + ok( !label.is( ".ui-state-focus" ) ); + check.focus(); + setTimeout(function() { + ok( label.is( ".ui-state-focus" ) ); + start(); + }); +}); + +// TODO: simulated click events don't behave like real click events in IE +// remove this when simulate properly simulates this +// see http://yuilibrary.com/projects/yui2/ticket/2528826 fore more info +if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) { + asyncTest( "Ensure checked after single click on checkbox label button", function() { + expect( 2 ); + + $( "#check2" ).checkboxradio().change( function() { + var label = $( this ).checkboxradio( "widget" ); + ok( this.checked, "checked ok" ); + + // The following test is commented out for now because with new markup we are trying to avoid aria + //ok( lbl.attr("aria-pressed") === "true", "aria ok" ); + ok( label.hasClass( "ui-state-active" ), "ui-state-active ok" ); + }); + + // Support: Opera + // Opera doesn't trigger a change event when this is done synchronously. + // This seems to be a side effect of another test, but until that can be + // tracked down, this delay will have to do. + setTimeout(function() { + $( "#check2" ).checkboxradio( "widget" ).simulate( "click" ); + start(); + }, 1 ); + }); +} +test( "Checkbox creation that requires a matching label does not find label in all cases", function() { + expect( 5 ); + var group = $( "" ); + group.find( "input[type=checkbox]" ).checkboxradio(); + ok( group.find( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.filter( "input[type=checkbox]" ).checkboxradio(); + ok( group.filter( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.find( "input[type=checkbox]" ).checkboxradio(); + ok( group.filter( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.find( "input[type=checkbox]" ).checkboxradio(); + ok( group.find( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.filter( "input[type=checkbox]" ).checkboxradio(); + ok( group.find( "label" ).is( ".ui-button" ) ); +}); + +asyncTest( "Resetting a button's form should refresh the visual state of the button widget to match.", function() { + expect( 2 ); + var form = $( "
" + + "" + + "
" ), + checkbox = form.find( "input[type=checkbox]" ).checkboxradio(); + + checkbox.prop( "checked", false ).checkboxradio( "refresh" ); + ok( !checkbox.checkboxradio( "widget" ).hasClass( "ui-state-active" ) ); + + form.get( 0 ).reset(); + + setTimeout(function() { + ok( checkbox.checkboxradio( "widget" ).hasClass( "ui-state-active" )); + start(); + }, 1 ); +}); +test( "Checkbox label selector works for ids with \":\"", function() { + expect( 1 ); + var group = $( "" ); + group.find( "input" ).checkboxradio(); + ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); +}); + +})(jQuery); diff --git a/tests/unit/checkboxradio/checkboxradio_methods.js b/tests/unit/checkboxradio/checkboxradio_methods.js new file mode 100644 index 00000000000..bcec6d9f059 --- /dev/null +++ b/tests/unit/checkboxradio/checkboxradio_methods.js @@ -0,0 +1,131 @@ +/* + * checkboxradio_methods.js + */ + + +(function($) { + +module( "Checkboxradio: methods" ); + test( "Checkbox: refresh", function() { + var checkbox = $( "#checkbox-method-refresh" ), + widget; + expect( 2 ); + checkbox.checkboxradio({ + icon: true + }); + + widget = checkbox.checkboxradio( "widget" ); + delete $(".ui-icon" )[0]; + + checkbox.checkboxradio( "refresh" ); + strictEqual( widget.find( ".ui-icon" ).length, 1, "Icon is recreated on refresh" ); + checkbox.prop( "checked", true ); + checkbox.checkboxradio( "refresh" ); + strictEqual( widget.hasClass( "ui-checkbox-checked" ), true, + "State updated based on checked property" ); + }); + + test( "Checkbox: destroy", function(){ + var checkbox = $( "#checkbox-method-destroy" ), + checkboxClasses = checkbox.attr( "class" ), + label = $( "#checkbox-method-destroy-label" ), + labelClasses = label.attr( "class" ); + + expect( 2 ); + checkbox.checkboxradio(); + checkbox.checkboxradio( "destroy" ); + strictEqual( checkbox.attr( "class"), checkboxClasses, + "checkbox classes match original after destroy" ); + strictEqual( label.attr( "class"), labelClasses, + "label classes match original after destroy" ); + }); + + test( "Checkbox: disable / enable", function(){ + var checkbox = $( "#checkbox-method-disable" ); + + expect( 4 ); + checkbox.checkboxradio(); + checkbox.checkboxradio( "disable" ); + strictEqual( checkbox.checkboxradio( "widget" ).hasClass( "ui-state-disabled" ), true, + "label gets ui-state-disabled when disable is called" ); + strictEqual( checkbox.is( ":disabled" ), true, + "checkbox is disabled when disable is called" ); + checkbox.checkboxradio( "enable" ); + strictEqual( checkbox.checkboxradio( "widget" ).hasClass( "ui-state-disabled" ), false, + "label has ui-state-disabled removed when enable is called" ); + strictEqual( checkbox.is( ":disabled" ), false, + "checkbox has disabled prop removed when enable is called" ); + }); + test( "Checkbox: widget returns the label", function(){ + var checkbox = $( "#checkbox-method-refresh" ), + label = $( "#checkbox-method-refresh-label" ); + + expect( 1 ); + + checkbox.checkboxradio(); + strictEqual( checkbox.checkboxradio( "widget" ).attr( "id" ), label.attr( "id" ), + "widget method returns label" ); + }); + + test( "Radio: refresh", function() { + var radio = $( "#radio-method-refresh" ), + widget; + expect( 2 ); + radio.checkboxradio({ + icon: true + }); + + widget = radio.checkboxradio( "widget" ); + delete $(".ui-icon" )[0]; + + radio.checkboxradio( "refresh" ); + strictEqual( widget.find( ".ui-icon" ).length, 1, "Icon is recreated on refresh" ); + radio.prop( "checked", true ); + radio.checkboxradio( "refresh" ); + strictEqual( widget.hasClass( "ui-radio-checked" ), true, + "State updated based on checked property" ); + }); + + test( "Radio: destroy", function(){ + var radio = $( "#radio-method-destroy" ), + radioClasses = radio.attr( "class" ), + label = $( "#radio-method-destroy-label" ), + labelClasses = label.attr( "class" ); + + expect( 2 ); + radio.checkboxradio(); + radio.checkboxradio( "destroy" ); + strictEqual( radio.attr( "class"), radioClasses, + "radio classes match original after destroy" ); + strictEqual( label.attr( "class"), labelClasses, + "label classes match original after destroy" ); + }); + + test( "Radio: disable / enable", function(){ + var radio = $( "#checkbox-method-disable" ); + + expect( 4 ); + radio.checkboxradio(); + radio.checkboxradio( "disable" ); + strictEqual( radio.checkboxradio( "widget" ).hasClass( "ui-state-disabled" ), true, + "label gets ui-state-disabled when disable is called" ); + strictEqual( radio.is( ":disabled" ), true, + "radio is disabled when disable is called" ); + radio.checkboxradio( "enable" ); + strictEqual( radio.checkboxradio( "widget" ).hasClass( "ui-state-disabled" ), false, + "label has ui-state-disabled removed when enable is called" ); + strictEqual( radio.is( ":disabled" ), false, + "radio has disabled prop removed when enable is called" ); + }); + test( "Radio: widget returns the label", function(){ + var radio = $( "#radio-method-refresh" ), + label = $( "#radio-method-refresh-label" ); + + expect( 1 ); + + radio.checkboxradio(); + strictEqual( radio.checkboxradio( "widget" ).attr( "id" ), label.attr( "id" ), + "widget method returns label" ); + }); + +})(jQuery); diff --git a/tests/unit/checkboxradio/checkboxradio_options.js b/tests/unit/checkboxradio/checkboxradio_options.js new file mode 100644 index 00000000000..1e6256ab1ac --- /dev/null +++ b/tests/unit/checkboxradio/checkboxradio_options.js @@ -0,0 +1,173 @@ +/* + * checkboxradio_methods.js + */ + + +(function($) { + +module( "Checkboxradio: checkbox: options" ); + test( "options: disabled", function() { + var checkbox = $( "#checkbox-option-disabled" ), + widget; + expect( 10 ); + checkbox.checkboxradio({ + disabled: true + }); + + widget = checkbox.checkboxradio( "widget" ); + + strictEqual( widget.hasClass( "ui-state-disabled" ), true, + "label gets ui-state-disabled when initial option set to true" ); + strictEqual( checkbox.is( ":disabled" ), true, + "checkbox is disabled when inital option is set to true" ); + + checkbox.checkboxradio( "option", "disabled", false ); + + strictEqual( widget.hasClass( "ui-state-disabled" ), false, + "label has ui-state-disabled removed when disabled set to false" ); + strictEqual( checkbox.is( ":disabled" ), false, + "checkbox has disabled prop removed when disabled set to false" ); + + checkbox.checkboxradio( "option", "disabled", true ); + + strictEqual( widget.hasClass( "ui-state-disabled" ), true, + "label gets ui-state-disabled when option set to true" ); + strictEqual( checkbox.is( ":disabled" ), true, + "checkbox is disabled when option is set to true" ); + + checkbox.checkboxradio( "destroy" ); + checkbox.prop( "disabled", true ); + checkbox.checkboxradio(); + + strictEqual( widget.hasClass( "ui-state-disabled" ), true, + "label gets ui-state-disabled when checkbox is disabled in dom on startup" ); + strictEqual( checkbox.is( ":disabled" ), true, + "checkbox is disabled when checkbox is disabled in dom on startup" ); + + checkbox.checkboxradio( "destroy" ); + checkbox.checkboxradio({ + disabled: null + }); + + strictEqual( widget.hasClass( "ui-state-disabled" ), true, + "passing null to disabled on startup checks the dom" ); + strictEqual( checkbox.is( ":disabled" ), true, + "passing null to disabled on startup checks the dom" ); + }); + test( "options: icon", function() { + var checkbox = $( "#checkbox-option-icon" ), + widget; + + expect( 9 ); + + checkbox.checkboxradio(); + + widget = checkbox.checkboxradio( "widget" ); + + strictEqual( widget.find( "span" ).length, 0, + "Label does not contain a span when created with icon:false" ); + + checkbox.checkboxradio( "destroy" ); + + checkbox.checkboxradio({ + icon: true + }); + + strictEqual( widget.find( "span" ).length, 1, + "Label contains a span when created with icon:true" ); + strictEqual( widget.find( "span" ).attr( "class" ), + "ui-icon ui-icon-background ui-corner-all ui-icon-blank", + "Icon span has proper classes when created not checked" ); + + checkbox.checkboxradio( "destroy" ).prop( "checked", true ); + + checkbox.checkboxradio({ + icon: true + }); + + strictEqual( widget.find( "span" ).attr( "class" ), + "ui-icon ui-icon-background ui-corner-all ui-icon-check", + "Icon span has proper classes when created checked" ); + + checkbox.checkboxradio( "option", "icon", false ); + + strictEqual( widget.find( "span" ).length, 0, + "Label does not contain a span when option set to icon:false and checked" ); + + checkbox.checkboxradio( "option", "icon", true ); + + strictEqual( widget.find( "span" ).attr( "class" ), + "ui-icon ui-icon-background ui-corner-all ui-icon-check", + "Icon span has proper classes when option set to true and :is( checked )" ); + + checkbox.prop( "checked", false ).checkboxradio( "refresh" ); + checkbox.checkboxradio( "option", "icon", false ); + + strictEqual( widget.find( "span" ).length, 0, + "Label does not contain a span when option set to icon:false and not checked" ); + + checkbox.checkboxradio( "option", "icon", true ); + + strictEqual( widget.find( "span" ).attr( "class" ), + "ui-icon ui-icon-background ui-corner-all ui-icon-blank", + "Icon span has proper classes when option set to true and not checked" ); + + checkbox.checkboxradio( "destroy" ); + + strictEqual( widget.find( "span" ).length, 0, + "Label does not contain a span after destroy when icon true" ); + + }); + test( "options: label", function() { + var checkbox = $( "#checkbox-option-label" ), + widget; + + expect( 10 ); + + checkbox.checkboxradio(); + + widget = checkbox.checkboxradio( "widget" ); + + strictEqual( checkbox.checkboxradio( "option", "label" ), + "checkbox label", "When no value passed on create text from dom is used for option" ); + strictEqual( widget.text(), + "checkbox label", "When no value passed on create text from dom is used in dom" ); + + checkbox.checkboxradio( "destroy" ); + + checkbox.checkboxradio({ + label: "foo" + }); + + strictEqual( checkbox.checkboxradio( "option", "label" ), + "foo", "When value is passed on create value is used for option" ); + strictEqual( widget.text(), + "foo", "When value is passed on create value is used in dom" ); + + checkbox.checkboxradio( "destroy" ); + checkbox.checkboxradio({ + label: null + }); + + strictEqual( checkbox.checkboxradio( "option", "label" ), + "foo", "When null is passed on create text from dom is used for option" ); + strictEqual( widget.text(), + "foo", "When null is passed on create text from dom is used in dom" ); + + checkbox.checkboxradio( "option", "label", "bar" ); + + strictEqual( checkbox.checkboxradio( "option", "label" ), + "bar", "When value is passed value is used for option" ); + strictEqual( widget.text(), + "bar", "When value is passed value is used in dom" ); + + checkbox.checkboxradio( "option", "label", "null" ); + + strictEqual( checkbox.checkboxradio( "option", "label" ), + "bar", "When null is passed text from dom is used for option" ); + strictEqual( widget.text(), + "bar", "When null is passed text from dom is used in dom" ); + + }); + +})(jQuery); diff --git a/tests/unit/controlgroup/controlgroup_core.js b/tests/unit/controlgroup/controlgroup_core.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 87f3553bedc..3c7a84050dc 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -154,10 +154,8 @@ test("buttons - advanced", function() { click: function() { equal(this, element[0], "correct context"); }, - icons: { - primary: "ui-icon-cancel" - }, - showText: false + icon: "ui-icon-cancel", + showLabel: false } ] }); @@ -167,8 +165,8 @@ test("buttons - advanced", function() { equal(buttons.attr("id"), "my-button-id", "correct id"); equal(buttons.text(), "a button", "correct label"); ok(buttons.hasClass("additional-class"), "additional classes added"); - deepEqual( buttons.button("option", "icons"), { primary: "ui-icon-cancel", secondary: null } ); - equal( buttons.button( "option", "text" ), false ); + deepEqual( buttons.button("option", "icon"), "ui-icon-cancel" ); + equal( buttons.button( "option", "showLabel" ), false ); buttons.click(); element.remove(); @@ -209,17 +207,17 @@ test("closeText", function() { expect(3); var element = $("
").dialog(); - equal(element.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "Close", + equal(element.dialog("widget").find(".ui-dialog-titlebar-close").text(), "Close", "default close text"); element.remove(); element = $("
").dialog({ closeText: "foo" }); - equal(element.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "foo", + equal(element.dialog("widget").find(".ui-dialog-titlebar-close").text(), "foo", "closeText on init"); element.remove(); element = $("
").dialog().dialog("option", "closeText", "bar"); - equal(element.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "bar", + equal(element.dialog("widget").find(".ui-dialog-titlebar-close").text(), "bar", "closeText via option method"); element.remove(); }); diff --git a/tests/unit/index.html b/tests/unit/index.html index bd48590ec37..21a00d7e8be 100644 --- a/tests/unit/index.html +++ b/tests/unit/index.html @@ -40,6 +40,7 @@

Widgets

  • Accordion
  • Autocomplete
  • Button
  • +
  • Checkboxradio
  • Datepicker
  • Dialog
  • Menu
  • diff --git a/tests/visual/button/button.html b/tests/visual/button/button.html index d4ce47b4037..65a9cb9b2d0 100644 --- a/tests/visual/button/button.html +++ b/tests/visual/button/button.html @@ -14,18 +14,14 @@ $( this ).children() .eq( 0 ) .button({ - text: false, - icons: { - primary: "ui-icon-help" - } + showLabel: false, + icon: "ui-icon-help" }) .end() .eq( 1 ) .button({ - icons: { - primary: "ui-icon-help" - }, - disabled: true + icon: "ui-icon-help", + disabled: false }) .end() .eq( 2 ) @@ -66,24 +62,6 @@
    -
    - - - - - - -
    - -
    - - - - - - -
    -
    anchor anchor diff --git a/themes/base/base.css b/themes/base/base.css index 479c3279d9b..be4508284a2 100644 --- a/themes/base/base.css +++ b/themes/base/base.css @@ -13,6 +13,7 @@ @import url("accordion.css"); @import url("autocomplete.css"); @import url("button.css"); +@import url("checkboxradio.css"); @import url("datepicker.css"); @import url("dialog.css"); @import url("draggable.css"); diff --git a/themes/base/button.css b/themes/base/button.css index 43ff15cfe43..31ed21aa27c 100644 --- a/themes/base/button.css +++ b/themes/base/button.css @@ -9,9 +9,9 @@ * http://api.jqueryui.com/button/#theming */ .ui-button { + padding: .4em 1em; display: inline-block; position: relative; - padding: 0; line-height: normal; margin-right: .1em; cursor: pointer; @@ -19,6 +19,7 @@ text-align: center; overflow: visible; /* removes extra width in IE */ } + .ui-button, .ui-button:link, .ui-button:visited, @@ -28,7 +29,15 @@ } /* to make room for the icon, a width needs to be set here */ .ui-button-icon-only { - width: 2.2em; + padding: 0; + width: 2.1em; + height: 2.1em; + text-indent: -9999px; + white-space: nowrap; +} +.ui-button .ui-icon { + position: absolute; + display: block; } /* button elements seem to need a little more width */ button.ui-button-icon-only { @@ -41,31 +50,6 @@ button.ui-button-icons-only { width: 3.7em; } -/* button text element */ -.ui-button .ui-button-text { - display: block; - line-height: normal; -} -.ui-button-text-only .ui-button-text { - padding: .4em 1em; -} -.ui-button-icon-only .ui-button-text, -.ui-button-icons-only .ui-button-text { - padding: .4em; - text-indent: -9999999px; -} -.ui-button-text-icon-primary .ui-button-text, -.ui-button-text-icons .ui-button-text { - padding: .4em 1em .4em 2.1em; -} -.ui-button-text-icon-secondary .ui-button-text, -.ui-button-text-icons .ui-button-text { - padding: .4em 2.1em .4em 1em; -} -.ui-button-text-icons .ui-button-text { - padding-left: 2.1em; - padding-right: 2.1em; -} /* no icon support for input elements, provide padding by default */ input.ui-button { padding: .4em 1em; @@ -85,16 +69,6 @@ input.ui-button { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, -.ui-button-text-icons .ui-button-icon-primary, -.ui-button-icons-only .ui-button-icon-primary { - left: .5em; -} -.ui-button-text-icon-secondary .ui-button-icon-secondary, -.ui-button-text-icons .ui-button-icon-secondary, -.ui-button-icons-only .ui-button-icon-secondary { - right: .5em; -} /* button sets */ .ui-buttonset { diff --git a/themes/base/checkboxradio.css b/themes/base/checkboxradio.css new file mode 100644 index 00000000000..7e90394df5d --- /dev/null +++ b/themes/base/checkboxradio.css @@ -0,0 +1,40 @@ +/*! + * jQuery UI Checkboxradio @VERSION + * http://jqueryui.com + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/checkboxradio/#theming + */ + +.ui-checkbox { + display: none; +} +.ui-checkbox-label .ui-icon-background { + border-radius: .12em; + border: none; +} +.ui-radio-label .ui-icon.ui-icon-background { + width: 16px; + height: 16px; + border-radius: 1em; + overflow: visible; + border: none; + background-color: rgb( 0, 0, 0 ); + background-color: rgba( 0, 0, 0, .3 ); + opacity: .3; +} +.ui-radio-label.ui-radio-checked .ui-icon, +.ui-radio-label.ui-radio-checked:hover .ui-icon { + background-image: none; + background-color: #fff; + width: 8px; + height: 8px; + border-width: 4px; + border-style: solid; +} +.ui-checkboxradio-disabled { + pointer-events: none; +} diff --git a/themes/base/core.css b/themes/base/core.css index 20d3d2a6d7a..a140e402781 100644 --- a/themes/base/core.css +++ b/themes/base/core.css @@ -71,7 +71,6 @@ /* Icons ----------------------------------*/ -/* states and images */ .ui-icon { display: block; text-indent: -99999px; @@ -79,6 +78,76 @@ background-repeat: no-repeat; } +.ui-button .ui-icon { + position: absolute; + display: block; + top: 50%; + margin-top: -8px; +} + +.ui-button.ui-icon-beginning { + padding-left: 2.4em; +} + +.ui-button.ui-icon-end { + padding: .4em 2.1em .4em 1em; +} + +.ui-button.ui-icon-top { + padding: 1.1em 1em .4em 1em; +} + +.ui-button.ui-icon-bottom { + padding: .4em 1em 1.1em 1em; +} + +.ui-icon { + left: .5em; + top: .3em; +} + +.ui-icon-end .ui-icon { + left: auto; + right: .5em; +} + +.ui-icon-top .ui-icon, +.ui-icon-bottom .ui-icon { + left: 50%; + margin-left: -11px; +} + +.ui-icon-top .ui-icon { + top: .6em; +} + +.ui-icon-bottom .ui-icon { + top: auto; + bottom: .05em; +} + +.ui-icon-notext .ui-icon { + left: 50%; + margin-left: -8px; +} + +.ui-button.ui-icon-notext .ui-icon { + padding: 0; + width: 2.1em; + height: 2.1em; + text-indent: -9999px; + white-space: nowrap; + +} + +input.ui-button.ui-icon-notext .ui-icon { + width: auto; + height: auto; + text-indent: 0; + white-space: normal; + padding: .4em 1em; +} + /* Misc visuals ----------------------------------*/ diff --git a/themes/base/theme.css b/themes/base/theme.css index 7ee080dfef7..3cf52ae01b3 100644 --- a/themes/base/theme.css +++ b/themes/base/theme.css @@ -50,15 +50,23 @@ ----------------------------------*/ .ui-state-default, .ui-widget-content .ui-state-default, -.ui-widget-header .ui-state-default { +.ui-widget-header .ui-state-default, +.ui-button { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url("images/ui-bg_glass_75_e6e6e6_1x400.png")/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; } +.ui-state-active .ui-icon-background { + background-color: #e6e6e6/*{bgColorDefault}*/; +} .ui-state-default a, .ui-state-default a:link, -.ui-state-default a:visited { +.ui-state-default a:visited, +a.ui-button, +a:link.ui-button, +a:visited.ui-button, +.ui-button { color: #555555/*{fcDefault}*/; text-decoration: none; } @@ -67,7 +75,9 @@ .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, -.ui-widget-header .ui-state-focus { +.ui-widget-header .ui-state-focus, +.ui-button:hover, +.ui-button:focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url("images/ui-bg_glass_75_dadada_1x400.png")/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; @@ -80,18 +90,29 @@ .ui-state-focus a, .ui-state-focus a:hover, .ui-state-focus a:link, -.ui-state-focus a:visited { +.ui-state-focus a:visited, +a.ui-button:hover, +a.ui-button:focus { color: #212121/*{fcHover}*/; text-decoration: none; } +.ui-visual-focus { + box-shadow: 0 0 3px 1px rgb(94, 158, 214); +} .ui-state-active, .ui-widget-content .ui-state-active, -.ui-widget-header .ui-state-active { +.ui-widget-header .ui-state-active, +a.ui-button:active, +.ui-button:active, +.ui-button.ui-state-active:hover { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url("images/ui-bg_glass_65_ffffff_1x400.png")/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; } +.ui-icon-background { + background-color: #ffffff/*{bgColorActive}*/; +} .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { @@ -168,15 +189,19 @@ .ui-widget-header .ui-icon { background-image: url("images/ui-icons_222222_256x240.png")/*{iconsHeader}*/; } -.ui-state-default .ui-icon { - background-image: url("images/ui-icons_888888_256x240.png")/*{iconsDefault}*/; +.ui-state-default .ui-icon, +.ui-button .ui-icon { + background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; } .ui-state-hover .ui-icon, -.ui-state-focus .ui-icon { - background-image: url("images/ui-icons_454545_256x240.png")/*{iconsHover}*/; -} -.ui-state-active .ui-icon { - background-image: url("images/ui-icons_454545_256x240.png")/*{iconsActive}*/; +.ui-state-focus .ui-icon, +.ui-button:hover .ui-icon, +.ui-button:focus .ui-icon { + background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; +} +.ui-state-active .ui-icon, +.ui-button:active .ui-icon { + background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; } .ui-state-highlight .ui-icon { background-image: url("images/ui-icons_2e83ff_256x240.png")/*{iconsHighlight}*/; diff --git a/ui/button.js b/ui/button.js index d9b027541ef..3a2127a39f0 100644 --- a/ui/button.js +++ b/ui/button.js @@ -24,31 +24,14 @@ } }(function( $ ) { -var lastActive, - baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", +var baseClasses = "ui-button ui-widget ui-corner-all", + typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons" + + " ui-button-text-only ui-icon-beginning ui-icon-end ui-icon-top ui-icon-bottom", formResetHandler = function() { var form = $( this ); setTimeout(function() { - form.find( ":ui-button" ).button( "refresh" ); - }, 1 ); - }, - radioGroup = function( radio ) { - var name = radio.name, - form = radio.form, - radios = $( [] ); - if ( name ) { - name = name.replace( /'/g, "\\'" ); - if ( form ) { - radios = $( form ).find( "[name='" + name + "'][type=radio]" ); - } else { - radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument ) - .filter(function() { - return !this.form; - }); - } - } - return radios; + form.find( ".ui-button" ).filter( ":ui-button" ).button( "refresh" ); + }); }; $.widget( "ui.button", { @@ -56,348 +39,179 @@ $.widget( "ui.button", { defaultElement: "" ) .button({ label: this.options.closeText, - icons: { - primary: "ui-icon-closethick" - }, - text: false + icon: "ui-icon-closethick", + showLabel: false }) .addClass( "ui-dialog-titlebar-close" ) .appendTo( this.uiDialogTitlebar ); @@ -463,8 +461,8 @@ return $.widget( "ui.dialog", { click.apply( that.element[ 0 ], arguments ); }; buttonOptions = { - icons: props.icons, - text: props.showText + icon: props.icon, + showLabel: props.showLabel }; delete props.icons; delete props.showText;