From 6add05f769e7e539ce8d213726f5d0b56cc52375 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 25 Jul 2024 15:54:58 -0400 Subject: [PATCH] we normally use single quotes --- documentation/docs/05-misc/02-testing.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/documentation/docs/05-misc/02-testing.md b/documentation/docs/05-misc/02-testing.md index b521c9915e..7e48a6ceb5 100644 --- a/documentation/docs/05-misc/02-testing.md +++ b/documentation/docs/05-misc/02-testing.md @@ -44,24 +44,24 @@ After that, you can create a test file in which you import the component to test ```js /// file: component.test.js -import { flushSync, mount, unmount } from "svelte"; -import { expect, test } from "vitest"; -import Component from "./Component.svelte"; +import { flushSync, mount, unmount } from 'svelte'; +import { expect, test } from 'vitest'; +import Component from './Component.svelte'; -test("Component", () => { +test('Component', () => { // Instantiate the component using Svelte's mount API const comp = mount(Component, { target: document.body, // document.body is available thanks to JSDOM props: { initial: 0 }, }); - expect(document.body.innerHTML).toBe(""); + expect(document.body.innerHTML).toBe(''); // Click the button, then flush the changes so you can synchronously write expectations - document.body.querySelector("button")!.click(); + document.body.querySelector('button')!.click(); flushSync(); - expect(document.body.innerHTML).toBe(""); + expect(document.body.innerHTML).toBe(''); // Remove the component from the DOM unmount(comp); @@ -124,7 +124,7 @@ test('Effect', () => { ## E2E tests using Playwright -E2E (short for "end to end") tests allow you to test your full application through the eyes of the user. This section uses [Playwright](https://playwright.dev/) as an example, but you can also use other solutions like [Cypress](https://www.cypress.io/) or [NightwatchJS](https://nightwatchjs.org/). +E2E (short for 'end to end') tests allow you to test your full application through the eyes of the user. This section uses [Playwright](https://playwright.dev/) as an example, but you can also use other solutions like [Cypress](https://www.cypress.io/) or [NightwatchJS](https://nightwatchjs.org/). To get start with Playwright, either let you guide by [their VS Code extension](https://playwright.dev/docs/getting-started-vscode), or install it from the command line using `npm init playwright`. It is also part of the setup CLI when you run `npm create svelte`.