treestyletab/tests/unit/TreeStyleTabBrowserAutoHide.test.js
2010-09-03 21:48:22 +00:00

51 lines
1.3 KiB
JavaScript

var autoHideFile = baseURL+'../../content/treestyletab/treestyletabbrowser_autoHide.js';
utils.include(baseURL+'../../content/treestyletab/treestyletab.js');
utils.include(autoHideFile);
var TSTBAutoHide = TreeStyleTabBrowserAutoHide;
var autoHide;
var owner;
function setUp()
{
utils.include(autoHideFile);
owner = new Mock('owner mock');
Mock.expect(TreeStyleTabBrowserAutoHide.prototype, 'init', []);
autoHide = new TreeStyleTabBrowserAutoHide(owner);
}
function tearDown()
{
owner = null;
}
test_fireStateChangingEvent.parameters = {
expanded : {
state : TSTBAutoHide.prototype.kSTATE_EXPANDED,
shown : true
},
shrunken : {
state : TSTBAutoHide.prototype.kSTATE_SHRUNKEN,
shown : false
},
hidden : {
state : TSTBAutoHide.prototype.kSTATE_HIDDEN,
shown : false
}
};
function test_fireStateChangingEvent(aParameter)
{
owner.browser = new Mock('browser');
owner.browser.expect('dispatchEvent', TypeOf(Ci.nsIDOMEvent))
.then(function(aEvent) {
assert.equals('TreeStyleTabAutoHideStateChanging', aEvent.type);
assert.strictlyEquals(aParameter.shown, aEvent.shown);
assert.equals(aParameter.state, aEvent.state);
});
Mock.expectGet(autoHide, 'state', aParameter.state).times(2);
autoHide.fireStateChangingEvent();
}