Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #22326 from dmarcos/bug1046316
Browse files Browse the repository at this point in the history
Bug 1046316 - [Camera] Focus view not appended to viewfinder
  • Loading branch information
dmarcos committed Jul 30, 2014
2 parents a855f29 + 3ea3a35 commit bb69e71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/camera/js/controllers/viewfinder.js
Expand Up @@ -47,7 +47,7 @@ ViewfinderController.prototype.createViews = function() {
this.views.viewfinder = this.app.views.viewfinder || new ViewfinderView();
this.views.focus = this.app.views.focus || new FocusView();
this.views.faces = this.app.views.faces || new FacesView();
this.views.faces.appendTo(this.views.viewfinder.el);
this.views.focus.appendTo(this.views.viewfinder.el);
this.views.faces.appendTo(this.views.viewfinder.el);
this.views.viewfinder.appendTo(this.app.el);
};
Expand Down
19 changes: 16 additions & 3 deletions apps/camera/test/unit/controllers/viewfinder_test.js
Expand Up @@ -15,10 +15,10 @@ suite('controllers/viewfinder', function() {
'lib/setting'
], function(
App, Camera, ViewfinderController, ViewfinderView,
FocusRingView, FacesView, Settings, Setting) {
FocusView, FacesView, Settings, Setting) {
self.ViewfinderController = ViewfinderController.ViewfinderController;
self.ViewfinderView = ViewfinderView;
self.FocusRingView = FocusRingView;
self.FocusView = FocusView;
self.FacesView = FacesView;
self.Settings = Settings;
self.Setting = Setting;
Expand All @@ -39,7 +39,7 @@ suite('controllers/viewfinder', function() {
this.app.settings.grid = sinon.createStubInstance(this.Setting);
this.app.views = {
viewfinder: sinon.createStubInstance(this.ViewfinderView),
focusRing: sinon.createStubInstance(this.FocusRingView),
focus: sinon.createStubInstance(this.FocusView),
faces: sinon.createStubInstance(this.FacesView)
};
this.app.Pinch = sinon.stub();
Expand All @@ -66,6 +66,7 @@ suite('controllers/viewfinder', function() {
this.viewfinder = this.controller.views.viewfinder;
this.focusRing = this.controller.views.focus;
this.faces = this.controller.views.faces;
this.focus = this.controller.views.focus;
this.settings = this.app.settings;
this.camera = this.app.camera;
});
Expand Down Expand Up @@ -125,6 +126,18 @@ suite('controllers/viewfinder', function() {
});
});

suite('ViewfinderController#createViews()', function() {
setup(function() {
this.controller.createViews();
});

test('It appends views to the viewfinder views', function() {
assert.isTrue(this.focus.appendTo.calledWith(this.viewfinder.el));
assert.isTrue(this.faces.appendTo.calledWith(this.viewfinder.el));
assert.isTrue(this.viewfinder.appendTo.calledWith(this.app.el));
});
});

suite('ViewfinderController#show()', function() {
setup(function() {
this.sandbox.stub(window, 'clearTimeout');
Expand Down

0 comments on commit bb69e71

Please sign in to comment.