button-test.js revision 33c93cea764d274a461e458c8908571efb379190
ArrayAssert = Y.ArrayAssert,
// -- Suite --------------------------------------------------------------------
// -- Widget ----------------------------------------------------------------
name: 'button widget',
setUp : function () {
Y.one("#container").setContent('<button id="testButton">Hello</button><button id="testToggleButton">Hello</button><button id="testCheckButton">Hello</button>');
srcNode: '#testButton'
}).render();
this.toggleButton = new Y.ToggleButton({
srcNode: '#testToggleButton'
}).render();
this.checkButton = new Y.ToggleButton({
srcNode: '#testCheckButton',
type: 'checkbox'
}).render();
},
tearDown: function () {
this.toggleButton.destroy();
this.checkButton.destroy();
delete this.button;
delete this.toggleButton;
delete this.checkButton;
},
'Changing the label atrribute should trigger labelChange': function () {
var eventsTriggered = 0;
eventsTriggered+=1;
});
},
'ToggleButton should have `toggle` role': function () {
var toggleButton = this.toggleButton;
},
'Selecting a toggleButton should add class `yui3-button-selected`': function () {
var button = this.toggleButton;
// Simulate the button click
},
'Select toggling a button should fire pressedChange': function () {
var toggleButton = this.toggleButton;
var eventsTriggered = 0;
eventsTriggered+=1;
});
},
'disable() should set the disabled attribute to true': function () {
},
'enable() should set the disabled attribute to false': function () {
},
'Setting `pressed` should toggle the `pressed` attribute': function () {
var button = this.toggleButton;
},
'Setting `checked` should toggle the `checked` attribute': function () {
var button = this.checkButton;
},
'Toggle buttons should have proper ARIA data': function () {
var button = this.toggleButton;
//button.set('pressed', true);
},
'Checkbox buttons should have proper ARIA data': function () {
var button = this.checkButton;
}
}));
// -- Config tests ----------------------------------------------------------------
name: 'button widget',
setUp : function () {
},
tearDown: function () {
},
'Passing `pressed=true` in with the config will default the button to a `pressed` state': function() {
var button = new Y.ToggleButton({
pressed: true
});
},
'Passing `checked=true` in with the config will default the button to a `checked` state': function() {
var button = new Y.ToggleButton({
checked: true,
type: 'checkbox'
});
}
}));
}, '@VERSION@', {
});