Skip to content

Instantly share code, notes, and snippets.

@jvans1
Last active December 21, 2015 16:59
Show Gist options
  • Save jvans1/6337376 to your computer and use it in GitHub Desktop.
Save jvans1/6337376 to your computer and use it in GitHub Desktop.
app.factory('PackageService', function(){
return {
tournamentsToHtml: function(tournaments){
var html = "<table class='table table-tooltip'><tr><td>Tournament</td><td>Markup</td></tr><tbody>"
for (var key in tournaments) {
html += "<tr>" + "<td>" + key + ": " + "</td>" + "<td>" + tournaments[key] + "</td>" + "</tr>"
};
html + "</tbody></table>"
return html
}
}
});
//= require application
describe("PackageService", function(){
describe("#tournamentListToHtml", function(){
var pckService;
beforeEach(function(){
module("app");
inject(function(PackageService){
pckService = PackageService
})
})
it("convert hash to table", function(){
pckService.tournamentListToHtml({"main event": "1.25", "5k 6m": "1.1"})
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment