test revision_list_btn is bound

shell of checkIfLatest test
This commit is contained in:
Sean McArthur 2011-10-17 12:21:49 -05:00
Родитель 0022902ba0
Коммит 9a96bfcde5
2 изменённых файлов: 29 добавлений и 6 удалений

Просмотреть файл

@ -25,6 +25,8 @@ module.exports = new Class({
attachments: {},
initialize: function PackageController(package, options) {
var controller = this;
this.package = package;
this.setOptions(options);
// reset version_name (in case of reload)
@ -37,13 +39,15 @@ module.exports = new Class({
}
this.instantiate_modules();
this.instantiate_modules();
this.instantiate_attachments();
this.instantiate_folders();
this.instantiate_dependencies();
// hook event to menu items
this.revision_list_btn = $('revisions_list')
this.revision_list_btn.addEvent('click', this.showRevisionList);
this.revision_list_btn.addEvent('click', function(e) {
controller.showRevisionList();
});
if (this.package.isAddon()) {
this.boundTestAddon = this.testAddon.bind(this);
this.options.test_url = $(this.options.test_el).getElement('a').get('href');
@ -102,7 +106,7 @@ module.exports = new Class({
},
showRevisionList: function(e) {
showRevisionList: function() {
},
@ -114,6 +118,11 @@ module.exports = new Class({
position: 'top',
balloon: true
});
}
},
checkIfLatest: function(failCallback) {
// we want to make a request each time, since the author could
// have created new changes while we were looking.
}
});

Просмотреть файл

@ -1,5 +1,7 @@
var dom = require('shipyard/dom'),
Spy = require('testigo/lib/spy').Spy,
Package = require('../../models/Package'),
PackageController = require('../../controllers/PackageController');
@ -51,8 +53,20 @@ module.exports = {
it('should register revisions_list click', function(expect) {
var pc = new PackageController(pack, {});
pc.showRevisionList = new Spy;
pc.revision_list_btn.fireEvent('click');
expect(1).toBe(1);
})
expect(pc.showRevisionList.getCallCount()).toBe(1);
});
it('should be able to determine if latest revision', function(expect) {
var pc = new PackageController(pack);
var fn = new Spy;
pc.checkIfLatest(fn);
expect(fn.getCallCount()).toBe(0);
});
}
}