Skip to content

Commit

Permalink
Ensured list was cleared before populating it.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlukeFan committed Jan 6, 2012
1 parent f6bb670 commit d898606
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Source/OfflineExample/Scripts/Offline/Index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// <reference path="..\json2.js"/>
/// <reference path="OfflineGlobal.js"/>

$(document).delegate("#pageAll", "pageinit", function () {
$(document).delegate("#pageAll", "pagebeforeshow", function () {
new indexController({
list: $("#pageAll #list"),
currentStatus: $("#pageAll #currentStatus"),
Expand All @@ -26,6 +26,7 @@ function indexController(view) {
indexController.prototype.populate = function () {
var view = this.getView();

view.list.text("");
view.list.append("<li data-params='Nov'><a href='/OfflineExample/Offline/Month'>Nov 2011 <span class='ui-li-count'>2</span></a></li>");
view.list.append("<li data-params='Jan'><a href='/OfflineExample/Offline/Month'>Jan 2011 <span class='ui-li-count'>7</span></a></li>");
view.list.append("<li data-params='Feb'><a href='/OfflineExample/Offline/Month'>Feb 2011 <span class='ui-li-count'>3</span></a></li>");
Expand Down
2 changes: 1 addition & 1 deletion Source/OfflineExample/Scripts/Offline/Months.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="..\jquery-1.7.1.min.js"/>

$(document).delegate("#pageMonth", "pageinit", function () {
$(document).delegate("#pageMonth", "pagebeforeshow", function () {
if (!window.params)
return; // no parameters defined

Expand Down
1 change: 1 addition & 0 deletions Source/OfflineExample/Scripts/Offline/spec/Index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe("Index tests", function () {
it("should populate items during construction", function () {
var index = new indexController(view);

expect(view.list.currentText).toBe(""); // verify list was 'cleared' first
expect(view.list.appended.length).toBe(4);
expect(view.list.appended[0]).toMatch("<li data-params='Nov'><a");
expect(view.list.appended[1]).toMatch("<li data-params='Jan'><a");
Expand Down

0 comments on commit d898606

Please sign in to comment.