/
top.test.js
41 lines (30 loc) · 908 Bytes
/
top.test.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
var chai = require("chai");
var expect = chai.expect;
import MyApp from "myapp";
import View from "jet-views/top";
let temp, app, view;
describe("/top", function() {
before(function(done){
temp = document.createElement("DIV");
document.body.appendChild(temp);
app = new MyApp({});
// if you are using async services on app
// you need to wait till they are ready
app.getService("user").getStatus(true).then(done);
// or, you can provide a stub instead
// app.getService("user").getUser = () => ({ name:"Alex" });
});
it("can be initialized", function() {
view = new View(app, "");
view.render(temp, "top");
});
it("has top menu", function() {
expect(view.$$("top:menu")).to.be.a("object");
});
it("has user name in header", function(){
expect(view.$$("header").config.template()).to.equal("Alex");
});
after(function(){
document.body.removeChild(temp);
});
});