describe ("Test UI", function () {
  describe ("Test Computer Message", function() {
    beforeEach (function() {
      setFixtures(' <h1 id = "Computer">Please wait until computer choice..</h1> ');
    });

    it ("Hides computer message", function() {
        UI.hideComputerMessage();
        expect($("#jasmine-fixtures #Computer")).toBeHidden();
    });
  });

  describe ("Test Human Message", function() {
    beforeEach (function() {
      setFixtures(' <h1 id = "Human">Please wait until computer choice..</h1> ');
    });

    it ("Hides computer message", function() {
        UI.hideHumanMessage();
        expect($("#jasmine-fixtures #Human")).toBeHidden();
    });
  });

  describe ("Test alert events", function() {
    var winner = "Player1";
    var alert;

    beforeEach (function() {
      alert = spyOn(window, "alert");
    });

    it ("Pops up a spot Error Message", function() {
      UI.spotErrorMessage();
      expect(alert).toHaveBeenCalledWith("That is not an available spot.\nPlease choose a different spot.");
    });

    it ("Pops up a win Message", function() {
      UI.winMessage(winner);
      expect(alert).toHaveBeenCalledWith("Congratulations.\n"+ winner +" win!!");
    });

    it ("Pops up a tie Message", function() {
      UI.tieMessage();
      expect(alert).toHaveBeenCalledWith("Game is tied.\nGame Over.");
    });

    it ("Pops up a inputError Message", function() {
      UI.inputErrorMessage();
      expect(alert).toHaveBeenCalledWith("You have to choose 'y' or 'n'.");
    });
  });

  describe ("Test prompt events", function() {
    var prompt;
    var chooesnPlayer;
    it ("Pops up a message to ask about choosen player", function() {
      prompt = spyOn(window, "prompt").and.returnValue("y");
      chooesnPlayer = UI.askFirstMove();
      UI.askFirstMove();
      expect(prompt).toHaveBeenCalledWith("Do you require the first move? (y/n)");
      expect(chooesnPlayer).toEqual("y");
    });
  });

  describe ("Test Displaing Button", function() {
    var unbind;
    beforeEach (function() {
      unbind = spyOn($.fn, "unbind");
      setFixtures(' <button type="button" class = "btn-start">Start Game</button> \
                              <button type="button" class = "btn-new">New Game</button> \
                              <button type="button" class = "btn-restart">Restart Game</button> \
                              <tr> \
                                <td id = "0">X</td> \
                                <td id = "1">O</td> \
                                <td id = "2">X</td> \
                              </tr> ');
    });

    it ("Hides start Button and unbind events, Show new Button", function() {
      UI.toggleDisplayedButton("#jasmine-fixtures .btn-start", "#jasmine-fixtures .btn-new");
      expect($("#jasmine-fixtures .btn-start")).toBeHidden();
      expect(unbind).toHaveBeenCalled();
      expect($("#jasmine-fixtures .btn-start")).not.toHandle("click");
      expect($("#jasmine-fixtures .btn-new")).toBeVisible();
    });

    it ("Hides restart and new Button", function() {
      UI.hideButton("#jasmine-fixtures .btn-restart", "#jasmine-fixtures .btn-new");
      expect($("#jasmine-fixtures .btn-new")).toBeHidden();
      expect($("#jasmine-fixtures .btn-restart")).toBeHidden();
    });
  });
});
@@ -179,33 +179,32 @@
 er choice..%3C/h1%3E
- 
 ');%0A    %7D);%0A%0A   
@@ -476,42 +476,29 @@
 an%22%3E
-Please wait until computer choice.
+Click a spot you want
 .%3C/h
@@ -524,32 +524,173 @@
  it (%22Hides 
-computer
+human message%22, function() %7B%0A        UI.hideHumanMessage();%0A        expect($(%22#jasmine-fixtures #Human%22)).toBeHidden();%0A    %7D);%0A%0A    it (%22Shows human
  message%22, f
@@ -774,38 +774,39 @@
 s #Human%22)).toBe
-Hidden
+Visible
 ();%0A    %7D);%0A  %7D)
@@ -2319,34 +2319,24 @@
             
-          
 %3Cbutton type
@@ -2379,34 +2379,24 @@
 %3C/button%3E %5C%0A
-          
             
@@ -2491,26 +2491,16 @@
         
-          
 %3Ctr%3E %5C%0A 
@@ -2516,34 +2516,24 @@
             
-     
-     
 %3Ctd id = %220%22
@@ -2538,34 +2538,24 @@
 0%22%3EX%3C/td%3E %5C%0A
-          
             
@@ -2604,34 +2604,24 @@
             
-   
-       
 %3Ctd id = %222%22
@@ -2626,34 +2626,24 @@
 2%22%3EX%3C/td%3E %5C%0A
-          
             

Test humanMessage() in UI