small js test fixes

This commit is contained in:
Maxwell Salzberg 2012-03-13 19:30:34 -07:00
parent af6b06ed9b
commit 56a7da530f
4 changed files with 12 additions and 12 deletions

View file

@ -3,13 +3,6 @@ describe("app", function() {
it("sets the user if given one and returns the current user", function() {
expect(app.user()).toBeFalsy()
});
it("sets the user if given one and returns the current user", function() {
expect(app.user().authenticated()).toBeFalsy()
app.user({name: "alice"});
expect(app.user().get("name")).toEqual("alice");
});
it("returns false if the current_user isn't set", function() {
app._user = undefined;
@ -17,4 +10,13 @@ describe("app", function() {
expect(app.user()).toEqual(false);
});
});
describe('currentUser', function(){
it("sets the user if given one and returns the current user", function() {
expect(app.currentUser.authenticated()).toBeFalsy()
app.user({name: "alice"});
expect(app.user().get("name")).toEqual("alice");
});
});
});

View file

@ -43,7 +43,7 @@ describe("app.views.StreamFaces", function(){
it("rerenders when people are added, but caps to 15 people", function(){
var posts = _.map(_.range(20), function(){ return factory.post()})
this.posts.reset(posts) //add 20 posts silently to the collection
this.posts.add(factory.post) //trigger an update
this.posts.add(factory.post()) //trigger an update
expect(this.view.$("img").length).toBe(15)
})
})

View file

@ -52,6 +52,7 @@ factory = {
var defaultAttrs = {
"provider_display_name" : null,
"created_at" : "2012-01-03T19:53:13Z",
"interacted_at" : '2012-01-03T19:53:13Z',
"last_three_comments" : null,
"public" : false,
"guid" : this.guid(),

View file

@ -6,8 +6,6 @@
describe("List", function() {
describe("runDelayedSearch", function() {
beforeEach( function(){
});
it('gets called on initialize', function(){
spyOn( List, 'startSearchDelay');
@ -23,9 +21,8 @@ describe("List", function() {
});
it('inserts contact html', function(){
List.handleSearchRefresh( { count:1,search_html: '<div class='testing_insert_div'>hello</div>' } );
List.handleSearchRefresh( { count:1, search_html: "<div class='testing_insert_div'>hello</div>" } );
expect($(".testing_insert_div").text().toEqual( "hello" ));
});
});
});