Skip to content

Commit 1a3f44d

Browse files
toolmantimSelenaSmallsaramic
committed
Made start button navigate to /rounds/1
Co-authored-by: Selena Small <selenawiththetattoo@gmail.com> Co-authored-by: Michael Milewski <saramic@gmail.com>
1 parent af7cd60 commit 1a3f44d

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

client/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class App extends Component {
77
<div className="App">
88
<header className="App-header">
99
<h2>Welcome to the Game</h2>
10-
<button>Start Game</button>
10+
<a href="/rounds/1" data-start-button>Start Game</a>
1111
</header>
1212
</div>
1313
);

client/src/App.test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ it('renders welcome message', () => {
1717
expect(shallowToJson(wrapper)).toMatchSnapshot();
1818
});
1919

20-
it('renders a button', () => {
21-
const wrapper = shallow(<App />);
22-
const button = <button>Start Game</button>;
23-
expect(wrapper.contains(button)).toEqual(true);
24-
});
20+
describe('button', () => {
21+
it('takes you to round 1 on click', () => {
22+
const wrapper = shallow(<App/>);
23+
expect(wrapper.find('[data-start-button]').prop('href')).toEqual('/rounds/1')
24+
});
25+
})

client/src/__snapshots__/App.test.js.snap

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ exports[`renders welcome message 1`] = `
1010
<h2>
1111
Welcome to the Game
1212
</h2>
13-
<button>
13+
<a
14+
data-start-button={true}
15+
href="/rounds/1"
16+
>
1417
Start Game
15-
</button>
18+
</a>
1619
</header>
1720
</div>
1821
`;

spec/features/games_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
visit '/'
66
expect(page).to have_content 'Welcome to the Game'
77

8-
page.find('button').click
8+
page.find('[data-start-button]').click
99
pending("Haven't written any rounds yet")
1010
expect(page).to have_content 'This is round 1'
1111
end

0 commit comments

Comments
 (0)