-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6861a83
commit 9a54c2e
Showing
16 changed files
with
222 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,5 @@ | |
row.append(game2View.render().el); | ||
this.$el.find('div#brackets-container').append(row); | ||
} | ||
|
||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
web-client/test/spec/views/tournament-first-round-view-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('BasketballTournament.Views.TournamentFirstRoundView', function () { | ||
var view, model; | ||
|
||
beforeEach(function () { | ||
model = new BasketballTournament.Models.TournamentRoundModel(BasketballTournament.DataBuilders.TournamentRoundDataBuilder.round1, {round: 1}); | ||
view = new BasketballTournament.Views.TournamentFirstRoundView({model: model}); | ||
}); | ||
|
||
describe('Initialization', function () { | ||
|
||
it('sets the Handlebars template.', function () { | ||
expect(view.template).toBe(JST['app/scripts/templates/tournament-first-round-view.hbs']); | ||
}); | ||
|
||
it('sets the tagName to "div".', function () { | ||
expect(view.tagName).toBe('div'); | ||
}); | ||
|
||
it('sets the className to "tournament-round-view".', function () { | ||
expect(view.className).toBe('tournament-round-view'); | ||
}); | ||
|
||
it('initializes an empty childViews array.', function () { | ||
expect(view.childViews).toBeDefined(); | ||
}); | ||
}); | ||
|
||
describe('Render view', function () { | ||
|
||
it("invokes the template function, passing an empty context.", function () { | ||
var spy = spyOn(view, 'template').andCallThrough(); | ||
view.render(); | ||
expect(spy).toHaveBeenCalledWith(model.toJSON()); | ||
}); | ||
|
||
it("invokes the $el.html function, pass the template invocation output.", function () { | ||
var spy = spyOn(view.$el, 'html').andCallThrough(); | ||
view.render(); | ||
expect(spy).toHaveBeenCalledWith(view.template(model.toJSON())); | ||
}); | ||
|
||
it('invokes the renderBrackets function.', function () { | ||
var spy = spyOn(view, 'renderBrackets'); | ||
view.render(); | ||
expect(spy).toHaveBeenCalled(); | ||
}); | ||
|
||
it("returns a reference to the view itself, for method chaining.", function () { | ||
expect(view.render()).toBe(view); | ||
}); | ||
}); | ||
|
||
describe('.renderBrackets function', function () { | ||
beforeEach(function () { | ||
view.$el = $('<div><div id="brackets-container"></div></div>'); | ||
}); | ||
|
||
it('should remove all previous child views.', function () { | ||
var spy = spyOn(view, 'removeChildViews'); | ||
view.renderBrackets(); | ||
expect(spy).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should render 4 game brackets for the first round.', function () { | ||
view.renderBrackets(); | ||
expect(view.$el.find('div.tournament-bracket-view').length).toBe(4); | ||
}); | ||
|
||
it('should have 4 child views in the childViews array.', function () { | ||
view.renderBrackets(); | ||
expect(view.childViews.length).toBe(4); | ||
}); | ||
}); | ||
}); | ||
|
||
})(); |
47 changes: 47 additions & 0 deletions
47
web-client/test/spec/views/tournament-national-finals-round-view-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('BasketballTournament.Views.TournamentNationalFinalsRoundView', function () { | ||
var view, model; | ||
|
||
beforeEach(function () { | ||
model = new BasketballTournament.Models.TournamentRoundModel(BasketballTournament.DataBuilders.TournamentRoundDataBuilder.round7, {round: 7}); | ||
view = new BasketballTournament.Views.TournamentNationalFinalsRoundView({model: model}); | ||
}); | ||
|
||
describe('Initialization', function () { | ||
it('sets the Handlebars template.', function () { | ||
expect(view.template).toBe(JST['app/scripts/templates/tournament-national-finals-round-view.hbs']); | ||
}); | ||
|
||
it('sets the tagName to "div".', function () { | ||
expect(view.tagName).toBe('div'); | ||
}); | ||
|
||
it('sets the className to "tournament-round-view".', function () { | ||
expect(view.className).toBe('tournament-round-view'); | ||
}); | ||
}); | ||
|
||
describe('Render view', function () { | ||
|
||
it("invokes the template function, passing an empty context.", function () { | ||
var spy = spyOn(view, 'template').andCallThrough(); | ||
view.render(); | ||
expect(spy).toHaveBeenCalledWith(model.toJSON()); | ||
}); | ||
|
||
it("invokes the $el.html function, pass the template invocation output.", function () { | ||
var spy = spyOn(view.$el, 'html').andCallThrough(); | ||
view.render(); | ||
expect(spy).toHaveBeenCalledWith(view.template(model.toJSON())); | ||
}); | ||
|
||
it("returns a reference to the view itself, for method chaining.", function () { | ||
expect(view.render()).toBe(view); | ||
}); | ||
}); | ||
}); | ||
|
||
})(); | ||
|
47 changes: 47 additions & 0 deletions
47
web-client/test/spec/views/tournament-national-semifinals-round-view-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('BasketballTournament.Views.TournamentNationalSemifinalsRoundView', function () { | ||
var view, model; | ||
|
||
beforeEach(function () { | ||
model = new BasketballTournament.Models.TournamentRoundModel(BasketballTournament.DataBuilders.TournamentRoundDataBuilder.round6, {round: 6}); | ||
view = new BasketballTournament.Views.TournamentNationalSemifinalsRoundView({model: model}); | ||
}); | ||
|
||
describe('Initialization', function () { | ||
it('sets the Handlebars template.', function () { | ||
expect(view.template).toBe(JST['app/scripts/templates/tournament-national-semifinals-round-view.hbs']); | ||
}); | ||
|
||
it('sets the tagName to "div".', function () { | ||
expect(view.tagName).toBe('div'); | ||
}); | ||
|
||
it('sets the className to "tournament-round-view".', function () { | ||
expect(view.className).toBe('tournament-round-view'); | ||
}); | ||
}); | ||
|
||
describe('Render view', function () { | ||
|
||
it("invokes the template function, passing an empty context.", function () { | ||
var spy = spyOn(view, 'template').andCallThrough(); | ||
view.render(); | ||
expect(spy).toHaveBeenCalledWith(model.toJSON()); | ||
}); | ||
|
||
it("invokes the $el.html function, pass the template invocation output.", function () { | ||
var spy = spyOn(view.$el, 'html').andCallThrough(); | ||
view.render(); | ||
expect(spy).toHaveBeenCalledWith(view.template(model.toJSON())); | ||
}); | ||
|
||
it("returns a reference to the view itself, for method chaining.", function () { | ||
expect(view.render()).toBe(view); | ||
}); | ||
}); | ||
}); | ||
|
||
})(); | ||
|
File renamed without changes.