button-test.js revision a62af74947827a1ef42d20c861b0b925b46bf4f4
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 () {
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@', {
});