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
88
gaia/apps/camera/test/unit/controllers/confirm_test.js
Executable file
88
gaia/apps/camera/test/unit/controllers/confirm_test.js
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
/*jshint maxlen:false*/
|
||||
'use strict';
|
||||
|
||||
suite('controllers/confirm', function() {
|
||||
suiteSetup(function(done) {
|
||||
var modules = this.modules = {};
|
||||
requirejs([
|
||||
'controllers/confirm',
|
||||
'views/confirm'
|
||||
], function(Controller, ConfirmView) {
|
||||
modules.controller = Controller;
|
||||
modules.ConfirmView = ConfirmView;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
setup(function() {
|
||||
var ConfirmView = this.modules.ConfirmView;
|
||||
var Controller = this.modules.controller;
|
||||
|
||||
this.app = {
|
||||
activity: {},
|
||||
camera: { on: sinon.spy() },
|
||||
ConfirmView: ConfirmView,
|
||||
on: sinon.spy()
|
||||
};
|
||||
|
||||
this.controller = new Controller(this.app);
|
||||
this.sandbox = sinon.sandbox.create();
|
||||
this.sandbox.spy(this.app, 'ConfirmView');
|
||||
this.sandbox.stub(ConfirmView.prototype);
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
this.sandbox.restore();
|
||||
});
|
||||
|
||||
suite('ConfirmController()', function() {
|
||||
test('Should bind to app `newmedia` event', function() {
|
||||
assert.ok(this.app.on.calledWith('newmedia'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('ConfirmController#onRecordingChange()', function() {
|
||||
setup(function() {
|
||||
this.app.activity.pick = true;
|
||||
this.controller.recording = true;
|
||||
sinon.stub(this.controller, 'renderView');
|
||||
});
|
||||
|
||||
test('Should set `recording` to true if starting', function() {
|
||||
this.controller.recording = false;
|
||||
this.controller.onRecordingChange('starting');
|
||||
assert.isTrue(this.controller.recording);
|
||||
});
|
||||
|
||||
test('Should set `recording` to false if error', function() {
|
||||
this.controller.onRecordingChange('error');
|
||||
assert.isFalse(this.controller.recording);
|
||||
});
|
||||
|
||||
test('Should render view if stopped', function() {
|
||||
this.controller.onRecordingChange('stopped');
|
||||
sinon.assert.called(this.controller.renderView);
|
||||
});
|
||||
|
||||
test('Should not do anything if recording failed and stopped', function() {
|
||||
this.controller.recording = false;
|
||||
this.controller.onRecordingChange('stopped');
|
||||
sinon.assert.notCalled(this.controller.renderView);
|
||||
});
|
||||
|
||||
test('Should not do anything if there is no active activity', function() {
|
||||
this.app.activity.pick = false;
|
||||
this.controller.onRecordingChange('stopped');
|
||||
sinon.assert.notCalled(this.controller.renderView);
|
||||
});
|
||||
});
|
||||
|
||||
suite('ConfirmController#onNewMedia()', function() {
|
||||
test('Should not do anything if there is no active activity', function() {
|
||||
this.app.activity.pick = false;
|
||||
this.controller.onNewMedia({});
|
||||
assert.ok(this.app.ConfirmView.notCalled);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue