diff --git a/js/main.js b/js/main.js
index 0849aad..dfb6246 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,9 +1,9 @@
-define(['handlebars'], function(Handlebars){
+define(['handlebars','handlebars_helpers','jquery'], function(Handlebars){
/* global Handlebars, $ */
// The template code
- var templateSource = document.getElementById('proposal-template').innerHTML;
+ var templateSource = $('#proposal-template').html();
// compile the template
var template = Handlebars.compile(templateSource);
@@ -529,6 +529,7 @@ define(['handlebars'], function(Handlebars){
votedProposals.push(id);
}
$.cookie("votedProposals", JSON.stringify(votedProposals), {expires : 999 }) ;
+ return votedProposals;
},
hasProposalbeenVoted: function(id) {
if (typeof($.cookie("votedProposals")) == "undefined") {
@@ -571,29 +572,14 @@ define(['handlebars'], function(Handlebars){
});
});
-
-
-
-
-
-
-
-
-
-
-
-
if('onhashchange' in window){
window.onhashchange = function(){
Main.locationHashChanged.apply(Main);
}
-
}else{
console.log('The browser not supports the hashchange event!');
}
-
-
-
+ return Main;
});
diff --git a/test/SpecRunner.html b/test/SpecRunner.html
index 6041417..57af9be 100644
--- a/test/SpecRunner.html
+++ b/test/SpecRunner.html
@@ -7,24 +7,30 @@
-
-
-
+
+
-
+
+
+
+
+
@@ -54,6 +60,7 @@
+
diff --git a/test/spec/MainSpec.js b/test/spec/MainSpec.js
index d6d7dfe..d1acfe1 100644
--- a/test/spec/MainSpec.js
+++ b/test/spec/MainSpec.js
@@ -1,8 +1,9 @@
-define(["model/main"],function(){
+define(["model/main"],function(Main){
describe("addVotedProposal", function(){
it("Should register a voted id", function(){
- addVotedProposal(1).toEqual(true);
+ expect(Main.addVotedProposal(1)).toContain(1);
+
});
});
});
--
libgit2 0.21.2