Skip to content
Browse files

refactor

  • Loading branch information...
1 parent b4149e2 commit 99ef551bd952dff11579175dd559c673d5a6905f @haru01 committed Apr 30, 2012
Showing with 11 additions and 12 deletions.
  1. +4 −4 test/server_spec.coffee
  2. +7 −8 views/index.jade
View
8 test/server_spec.coffee
@@ -12,7 +12,7 @@ suite 'Life Game', ->
test 'タイトルがとれること', ->
expect( $.text("title") ).to.equal("Life Game")
- # test '誕生できること', ->
- # $.pressButton "#birth"
- # $.pressButton "#next"
- # expect( $.text(".cell1-1") ).to.equal("o")
+ test '誕生できること', ->
+ $.pressButton "#birth"
+ $.pressButton "#next"
+ expect( $.text(".cell1-1") ).to.equal("o")
View
15 views/index.jade
@@ -11,11 +11,10 @@ script
(function($) {
var GenerationView = Backbone.View.extend({
el: $('#board'),
- generation: $('#generation'),
events: {
- 'click button#next': 'nextGeneration'
- ,'click button#birth': 'birth'
+ 'click #next': 'nextGeneration'
+ ,'click #birth': 'birth'
},
initialize: function() {
@@ -34,16 +33,16 @@ script
var row = $("<tr>");
table.append(row);
for (var x = 0; x < cells[y].length; x++) {
+ var cll= "cell" + x + "-" + y;
if (cells[y][x] == 1) {
- var cll= "alive " + "cell" + x + "-" + y;
- row.append("<td class='" + cll + "'>o</td>");
+ row.append("<td class='alive " + cll + "'>o</td>");
} else {
- row.append("<td></td>");
+ row.append("<td class='" + cll + "'>o</td>");
}
};
};
- $("div#generation").empty();
- $("div#generation").append(table);
+ $("#generation").empty();
+ $("#generation").append(table);
},
nextGeneration: function() {

0 comments on commit 99ef551

Please sign in to comment.
Something went wrong with that request. Please try again.