2010-09-03 17:48:22 -04:00
|
|
|
var autoHideFile = baseURL+'../../content/treestyletab/treestyletabbrowser_autoHide.js';
|
|
|
|
|
2010-09-02 14:33:59 -04:00
|
|
|
utils.include(baseURL+'../../content/treestyletab/treestyletab.js');
|
2010-09-03 17:48:22 -04:00
|
|
|
utils.include(autoHideFile);
|
|
|
|
var TSTBAutoHide = TreeStyleTabBrowserAutoHide;
|
2010-09-02 14:33:59 -04:00
|
|
|
|
|
|
|
var autoHide;
|
|
|
|
var owner;
|
|
|
|
|
|
|
|
function setUp()
|
|
|
|
{
|
2010-09-03 17:48:22 -04:00
|
|
|
utils.include(autoHideFile);
|
|
|
|
|
2010-09-02 14:33:59 -04:00
|
|
|
owner = new Mock('owner mock');
|
|
|
|
Mock.expect(TreeStyleTabBrowserAutoHide.prototype, 'init', []);
|
|
|
|
autoHide = new TreeStyleTabBrowserAutoHide(owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
function tearDown()
|
|
|
|
{
|
2010-09-03 17:48:22 -04:00
|
|
|
owner = null;
|
2010-09-02 14:33:59 -04:00
|
|
|
}
|
|
|
|
|
2010-09-03 17:48:22 -04:00
|
|
|
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)
|
2010-09-02 14:33:59 -04:00
|
|
|
{
|
|
|
|
owner.browser = new Mock('browser');
|
|
|
|
owner.browser.expect('dispatchEvent', TypeOf(Ci.nsIDOMEvent))
|
|
|
|
.then(function(aEvent) {
|
2010-09-03 17:48:22 -04:00
|
|
|
assert.equals('TreeStyleTabAutoHideStateChanging', aEvent.type);
|
|
|
|
assert.strictlyEquals(aParameter.shown, aEvent.shown);
|
|
|
|
assert.equals(aParameter.state, aEvent.state);
|
2010-09-02 14:33:59 -04:00
|
|
|
});
|
2010-09-03 17:48:22 -04:00
|
|
|
Mock.expectGet(autoHide, 'state', aParameter.state).times(2);
|
2010-09-02 14:33:59 -04:00
|
|
|
|
|
|
|
autoHide.fireStateChangingEvent();
|
|
|
|
}
|