This repository was archived by the owner on Oct 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathlayout.spec.js
69 lines (50 loc) · 1.67 KB
/
layout.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
describe("application layout", function(){
"use strict";
describe("when the application starts", function(){
var appLayout, controller;
beforeEach(function(){
affix("section.content .container");
appLayout = BBCloneMail.module("AppLayout");
appLayout.start();
controller = appLayout.controller;
});
afterEach(function(){
appLayout.stop();
});
it("should attach the layout to the main content", function(){
expect(controller.layout.$el).toEqual($("section.content"));
});
});
describe("given the app layout in place", function(){
var appLayout, startHandler;
beforeEach(function(){
affix("section.content .container #app-selector select option[value=MailApp]+option[value=ContactsApp]");
startHandler = spyOn(BBCloneMail, "execute");
appLayout = BBCloneMail.module("AppLayout");
appLayout.start();
});
afterEach(function(){
appLayout.stop();
});
describe("when selecting the mail app", function(){
beforeEach(function(){
var $app = $("#app-selector select");
$app.val("MailApp");
$app.trigger("change");
});
it("should switch to the mail app", function(){
expect(startHandler).toHaveBeenCalledWith("start:app", "MailApp");
});
});
describe("when selecting the contacts app", function(){
beforeEach(function(){
var $app = $("#app-selector select");
$app.val("ContactsApp");
$app.trigger("change");
});
it("should switch to the contacts app", function(){
expect(startHandler).toHaveBeenCalledWith("start:app", "ContactsApp");
});
});
});
});