Skip to content

Commit 032d88e

Browse files
Merge pull request #6 from cypress-io/jordanpowell88/update-docs-and-props
chore: update documentation and props to align to new docs
2 parents 591e2fb + 3dd61db commit 032d88e

File tree

9 files changed

+30
-39
lines changed

9 files changed

+30
-39
lines changed
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
import Stepper from './Stepper';
1+
import Stepper from "./Stepper";
22

3-
describe('<Stepper>', () => {
4-
it('mounts', () => {
3+
describe("<Stepper>", () => {
4+
it("mounts", () => {
55
cy.mount(<Stepper />);
66
});
77

8-
it('stepper should default to 0', () => {
8+
it("stepper should default to 0", () => {
99
cy.mount(<Stepper />);
10-
cy.get('[data-cy=counter]').should('have.text', '0');
10+
cy.get("[data-cy=counter]").should("have.text", "0");
1111
});
1212

13-
it('supports an "initial" prop to set the value', () => {
14-
cy.mount(<Stepper initial={100} />);
15-
cy.get('[data-cy=counter]').should('have.text', '100');
13+
it('supports a "count" prop to set the value', () => {
14+
cy.mount(<Stepper count={100} />);
15+
cy.get("[data-cy=counter]").should("have.text", "100");
1616
});
1717

18-
it('when the increment button is pressed, the counter is incremented', () => {
18+
it("when the increment button is pressed, the counter is incremented", () => {
1919
cy.mount(<Stepper />);
20-
cy.get('[data-cy=increment]').click();
21-
cy.get('[data-cy=counter]').should('have.text', '1');
20+
cy.get("[data-cy=increment]").click();
21+
cy.get("[data-cy=counter]").should("have.text", "1");
2222
});
2323

24-
it('when the decrement button is pressed, the counter is decremented', () => {
24+
it("when the decrement button is pressed, the counter is decremented", () => {
2525
cy.mount(<Stepper />);
26-
cy.get('[data-cy=decrement]').click();
27-
cy.get('[data-cy=counter]').should('have.text', '-1');
26+
cy.get("[data-cy=decrement]").click();
27+
cy.get("[data-cy=counter]").should("have.text", "-1");
2828
});
2929

30-
it('clicking + fires a change event with the incremented value', () => {
31-
const onChangeSpy = cy.spy().as('onChangeSpy');
30+
it("clicking + fires a change event with the incremented value", () => {
31+
const onChangeSpy = cy.spy().as("onChangeSpy");
3232
cy.mount(<Stepper onChange={onChangeSpy} />);
33-
cy.get('[data-cy=increment]').click();
34-
cy.get('@onChangeSpy').should('have.been.calledWith', 1);
33+
cy.get("[data-cy=increment]").click();
34+
cy.get("@onChangeSpy").should("have.been.calledWith", 1);
3535
});
3636
});

react/my-awesome-app/src/components/Stepper.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { useState } from 'react';
1+
import { useState } from "react";
22

3-
export default function Stepper({ initial = 0, onChange = () => {} }) {
4-
const [count, setCount] = useState(initial);
3+
export default function Stepper({ count: _count = 0, onChange = () => {} }) {
4+
const [count, setCount] = useState(_count);
55

66
const handleIncrement = () => {
77
const newCount = count + 1;

react/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Cypress Component Testing Quickstart App for React.
22

33
This is a completed version of the app from the
4-
[quickstart](https://docs.cypress.io/guides/component-testing/react/quickstart)
4+
[quickstart](https://docs.cypress.io/guides/component-testing/getting-started)
55
guide for writing component tests for Cypress with React.
66

77
To try the app locally, first clone the quickstart repo:

readme.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
# Cypress Component Testing Quickstart Apps
22

33
This repo contains completed versions of the quickstart apps from the component
4-
testing quickstart guides on docs.cypress.io:
5-
6-
- [Angular Guide](https://docs.cypress.io/guides/component-testing/angular/quickstart) -
7-
[Completed Example App](/angular/my-awesome-app)
8-
- [React Guide](https://docs.cypress.io/guides/component-testing/react/quickstart) -
9-
[Completed Example App](/react/my-awesome-app)
10-
- [Svelte Guide](https://docs.cypress.io/guides/component-testing/svelte/quickstart) -
11-
[Completed Example App](/svelte/my-awesome-app)
12-
- [Vue Guide](https://docs.cypress.io/guides/component-testing/vue/quickstart) -
13-
[Completed Example App](/vue/my-awesome-app)
4+
testing quickstart guides at [https://docs.cypress.io/guides/component-testing/getting-started](https://docs.cypress.io/guides/component-testing/getting-started)
145

156
Visit [docs.cypress.io](https://docs.cypress.io) for more information on
167
component testing with Cypress.

svelte/my-awesome-app/src/lib/Stepper.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Stepper', () => {
1010
cy.get('[data-cy=counter]').should('have.text', '0');
1111
});
1212

13-
it('supports an "initial" prop to set the value', () => {
13+
it('supports a "count" prop to set the value', () => {
1414
cy.mount(Stepper, { props: { count: 100 } });
1515
cy.get('[data-cy=counter]').should('have.text', '100');
1616
});

svelte/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Cypress Component Testing Quickstart App for Svelte.
22

33
This is a completed version of the app from the
4-
[quickstart](https://docs.cypress.io/guides/component-testing/svelte/quickstart)
4+
[quickstart](https://docs.cypress.io/guides/component-testing/getting-started)
55
guide for writing component tests for Cypress with Svelte.
66

77
To try the app locally, first clone the quickstart repo:

vue/my-awesome-app/src/components/Stepper.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ describe('<Stepper />', () => {
1111
cy.get('[data-cy=counter]').should('have.text', '0');
1212
});
1313

14-
it('supports an "initial" prop to set the value', () => {
15-
cy.mount(Stepper, { props: { initial: 100 } });
14+
it('supports a "count" prop to set the value', () => {
15+
cy.mount(Stepper, { props: { count: 100 } });
1616
cy.get('[data-cy=counter]').should('have.text', '100');
1717
});
1818

vue/my-awesome-app/src/components/Stepper.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
<script setup>
1010
import { ref } from 'vue'
11-
const props = defineProps(['initial'])
11+
const props = defineProps(['count'])
1212
1313
const emit = defineEmits(['change'])
1414
15-
const count = ref(props.initial || 0)
15+
const count = ref(props.count || 0)
1616
1717
const increment = () => {
1818
count.value++

vue/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Cypress Component Testing Quickstart App for Vue.
22

33
This is a completed version of the app from the
4-
[quickstart](https://docs.cypress.io/guides/component-testing/vue/quickstart)
4+
[quickstart](https://docs.cypress.io/guides/component-testing/getting-started)
55
guide for writing component tests for Cypress with Vue.
66

77
To try the app locally, first clone the quickstart repo:

0 commit comments

Comments
 (0)