Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
78
gaia/apps/camera/test/unit/views/settings_test.js
Executable file
78
gaia/apps/camera/test/unit/views/settings_test.js
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
suite('views/settings', function() {
|
||||
'use strict';
|
||||
|
||||
suiteSetup(function(done) {
|
||||
var self = this;
|
||||
requirejs([
|
||||
'views/settings',
|
||||
'views/setting-options'
|
||||
], function(SettingsView, OptionsView) {
|
||||
self.SettingsView = SettingsView;
|
||||
self.OptionsView = OptionsView;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
setup(function() {
|
||||
var self = this;
|
||||
this.sandbox = sinon.sandbox.create();
|
||||
|
||||
var OptionsView = sinon.spy(function() {
|
||||
var view = sinon.createStubInstance(self.OptionsView);
|
||||
view.render.returns(view);
|
||||
view.appendTo.returns(view);
|
||||
view.on.returns(view);
|
||||
return view;
|
||||
});
|
||||
|
||||
this.view = new this.SettingsView({ OptionsView: OptionsView });
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
this.sandbox.restore();
|
||||
});
|
||||
|
||||
suite('SettingsView#onClick()', function() {
|
||||
test('Should not let clicks propagate', function() {
|
||||
var spy = sinon.spy();
|
||||
this.view.onClick({ stopPropagation: spy });
|
||||
assert.isTrue(spy.called);
|
||||
});
|
||||
});
|
||||
|
||||
suite('SettingsView#showSetting()', function() {
|
||||
setup(function() {
|
||||
this.model = {};
|
||||
this.sandbox.spy(this.view, 'showPane');
|
||||
this.view.showSetting(this.model);
|
||||
});
|
||||
|
||||
test('Should create and append a new OptionsView', function() {
|
||||
assert.isTrue(this.view.OptionsView.called);
|
||||
assert.isTrue(this.view.optionsView.appendTo.called);
|
||||
});
|
||||
|
||||
test('Should pass the model into the OptionsView', function() {
|
||||
var options = this.view.OptionsView.args[0][0];
|
||||
assert.equal(options.model, this.model);
|
||||
});
|
||||
|
||||
test('Should show pane 2', function() {
|
||||
assert.isTrue(this.view.showPane.calledWith(2));
|
||||
});
|
||||
});
|
||||
|
||||
suite('SettingsView#goBack()', function() {
|
||||
test('Should destroy the options view (sync)', function() {
|
||||
var options = this.view.optionsView = { destroy: sinon.spy() };
|
||||
this.view.goBack();
|
||||
assert.isTrue(options.destroy.called);
|
||||
});
|
||||
|
||||
test('Should switch back to pane 1', function() {
|
||||
sinon.spy(this.view, 'showPane');
|
||||
this.view.goBack();
|
||||
assert.isTrue(this.view.showPane.calledWith(1));
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue