Skip to content

Commit 4285387

Browse files
authored
style: add missing file titles (#1076)
1 parent 691b11e commit 4285387

File tree

16 files changed

+39
-59
lines changed

16 files changed

+39
-59
lines changed

docs/angular-testing-library/examples.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ sidebar_label: Examples
99
> or follow the
1010
> [guided example](https://timdeschryver.dev/blog/getting-the-most-value-out-of-your-angular-component-tests)
1111
12-
counter.component.ts
13-
14-
```typescript
12+
```ts title="counter.component.ts"
1513
@Component({
1614
selector: 'counter',
1715
template: `
@@ -33,9 +31,7 @@ export class CounterComponent {
3331
}
3432
```
3533

36-
counter.component.spec.ts
37-
38-
```typescript
34+
```ts title="counter.component.spec.ts"
3935
import {render, screen, fireEvent} from '@testing-library/angular'
4036
import {CounterComponent} from './counter.component.ts'
4137

docs/bs-react-testing-library/examples.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ You can find more bs-react-testing-library examples at
1111

1212
## React Testing Library
1313

14-
```reason
15-
/* Component_test.re */
16-
14+
```reason title="Component_test.re"
1715
open Jest;
1816
open Expect;
1917
open ReactTestingLibrary;
@@ -37,8 +35,7 @@ with typings and creating events.
3735

3836
### getByText
3937

40-
```reason
41-
/* __tests__/example_test.re */
38+
```reason title="__tests__/example_test.re"
4239
open Jest;
4340
open DomTestingLibrary;
4441
open Expect;

docs/cypress-testing-library/intro.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ npm install --save-dev cypress @testing-library/cypress
1818

1919
Add this line to your project's `cypress/support/commands.js`:
2020

21-
```
22-
import '@testing-library/cypress/add-commands';
21+
```js
22+
import '@testing-library/cypress/add-commands'
2323
```
2424

2525
You can now use all of `DOM Testing Library`'s `findBy`, `findAllBy`, `queryBy`

docs/dom-testing-library/api-custom-queries.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ to use a different data-attribute. (Note: test files would import
2121
> Custom queries are different than
2222
> [custom render](react-testing-library/setup.mdx#custom-render) methods.
2323
24-
```js
25-
// test-utils.js
24+
```js title="test-utils.js"
2625
const domTestingLib = require('@testing-library/dom')
2726
const {queryHelpers} = domTestingLib
2827

docs/dom-testing-library/example-intro.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ title: Example
44
sidebar_label: Example
55
---
66

7-
```javascript
8-
// src/__tests__/example.js
7+
```js title="src/__tests__/example.js"
98
// query utilities:
109
import {
1110
getByLabelText,

docs/ecosystem-bs-jest-dom.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ full list of available matchers.
3030

3131
## Example
3232

33-
```reason
34-
/* A_test.re */
35-
33+
```reason title="A_test.re"
3634
open Jest;
3735
open JestDom;
3836
open ReactTestingLibrary;

docs/ecosystem-jest-native.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ for Jest.
1212
npm install --save-dev @testing-library/jest-native
1313
```
1414

15-
```javascript
15+
```jsx
1616
const {queryByTestId} = render(
1717
<View>
1818
<View testID="not-empty">

docs/marko-testing-library/setup.mdx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ version of all modules as mentioned above.
3232
To test components rendered on the client-side, be sure to enable both the
3333
`browser` option and the preset and you are good to go!
3434

35-
**jest.config.js**
36-
37-
```javascript
35+
```js title="jest.config.js"
3836
module.exports = {
3937
preset: '@marko/jest/preset/browser',
4038
}
@@ -43,9 +41,7 @@ module.exports = {
4341
For testing components rendered on the server-side we can instead use
4442
`@marko/jest/preset/node` as our jest preset.
4543

46-
**jest.config.js**
47-
48-
```javascript
44+
```js title="jest.config.js"
4945
module.exports = {
5046
preset: '@marko/jest/preset/node',
5147
}
@@ -56,9 +52,7 @@ A Jest configuration can also have multiple
5652
which we can use to create a combined configuration for server-side tests, and
5753
client-side tests, like so:
5854

59-
**jest.config.js**
60-
61-
```javascript
55+
```js title="jest.config.js"
6256
module.exports = {
6357
projects: [
6458
{

docs/react-native-testing-library/example-intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Example
44
sidebar_label: Example
55
---
66

7-
```javascript
7+
```jsx
88
import React from 'react'
99
import {Button, Text, TextInput, View} from 'react-native'
1010
import {fireEvent, render, waitFor} from '@testing-library/react-native'

docs/react-native-testing-library/setup.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ with this file in all your imports. See
2121
[below](#configuring-jest-with-test-utils) for a way to make your test util file
2222
accessible without using relative paths.
2323

24-
```diff
25-
// my-component.test.js
24+
```diff title="my-component.test.js"
2625
- import { render, fireEvent } from '@testing-library/react-native';
2726
+ import { render, fireEvent } from '../test-utils';
2827
```
2928

30-
```js
31-
// test-utils.js
29+
```jsx title="test-utils.js"
3230
import {render} from '@testing-library/react-native'
3331
import {ThemeProvider} from 'my-ui-lib'
3432
import {TranslationProvider} from 'my-i18n-lib'
@@ -63,14 +61,12 @@ Jest `moduleDirectories` option.
6361
This will make all the `.js` files in the test-utils directory importable
6462
without `../`.
6563

66-
```diff
67-
// my-component.test.js
64+
```diff title="my-component.test.js"
6865
- import { render, fireEvent } from '../test-utils';
6966
+ import { render, fireEvent } from 'test-utils';
7067
```
7168

72-
```diff
73-
// jest.config.js
69+
```diff title="jest.config.js"
7470
module.exports = {
7571
moduleDirectories: [
7672
'node_modules',

docs/react-testing-library/api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ for common data providers. See [setup](setup.mdx#custom-render) for examples.
122122
Queries to bind. Overrides the default set from `DOM Testing Library` unless
123123
merged.
124124

125-
```js
125+
```jsx
126126
// Example, a function to traverse table contents
127127
import * as tableQueries from 'my-table-query-library'
128128
import {queries} from '@testing-library/react'

docs/react-testing-library/example-intro.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ sidebar_label: Example
88

99
See the following sections for a detailed breakdown of the test
1010

11-
```jsx
12-
// __tests__/fetch.test.js
11+
```jsx title="__tests__/fetch.test.jsx"
1312
import React from 'react'
1413
import {rest} from 'msw'
1514
import {setupServer} from 'msw/node'
@@ -169,9 +168,7 @@ expect(screen.getByRole('button')).not.toBeDisabled()
169168

170169
### System Under Test
171170

172-
fetch.js
173-
174-
```jsx
171+
```jsx title="fetch.jsx"
175172
import React, {useState, useReducer} from 'react'
176173
import axios from 'axios'
177174

docs/react-testing-library/faq.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TL;DR:
1515

1616
In summary:
1717

18-
```javascript
18+
```jsx
1919
import React from 'react'
2020
import {render, fireEvent} from '@testing-library/react'
2121

@@ -109,7 +109,7 @@ to, then try to use
109109
One case where I've found mocking to be especially useful is for animation
110110
libraries. I don't want my tests to wait for animations to end.
111111

112-
```javascript
112+
```jsx
113113
jest.mock('react-transition-group', () => {
114114
const FakeTransition = jest.fn(({children}) => children)
115115
const FakeCSSTransition = jest.fn(props =>

docs/react-testing-library/setup.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ export {customRender as render}
114114
> [#169](https://github.com/testing-library/react-testing-library/issues/169)
115115
> and the workaround below.
116116
117+
<details>
118+
117119
<summary>Workaround for Babel 6</summary>
118120

119121
You can use CommonJS modules instead of ES modules, which should work in Node:
@@ -133,6 +135,8 @@ module.exports = {
133135
}
134136
```
135137

138+
</details>
139+
136140
### Add custom queries
137141

138142
> **Note**
@@ -198,8 +202,7 @@ render method:
198202

199203
<TabItem value="jsx">
200204

201-
```jsx title="test-utils.js"
202-
// test-utils.js
205+
```js title="test-utils.js"
203206
import {render, queries} from '@testing-library/react'
204207
import * as customQueries from './custom-queries'
205208

@@ -217,8 +220,7 @@ export {customRender as render}
217220

218221
<TabItem value="tsx">
219222

220-
```tsx title="test-utils.ts"
221-
// test-utils.ts
223+
```ts title="test-utils.ts"
222224
import {render, queries, RenderOptions} from '@testing-library/react'
223225
import * as customQueries from './custom-queries'
224226
import {ReactElement} from 'react'
@@ -272,7 +274,7 @@ module.exports = {
272274
If you're using TypeScript, merge this into your `tsconfig.json`. If you're
273275
using Create React App without TypeScript, save this to `jsconfig.json` instead.
274276

275-
```diff title="tsconfig.json"
277+
```json title="tsconfig.json"
276278
{
277279
"compilerOptions": {
278280
"baseUrl": "src",
@@ -398,14 +400,14 @@ To enable automatic cleanup in Mocha's watch mode, add a cleanup
398400
[root hook](https://mochajs.org/#root-hook-plugins). Create a
399401
`mocha-watch-cleanup-after-each.js` file with the following contents:
400402

401-
```
402-
const { cleanup } = require("@testing-library/react");
403+
```js title="mocha-watch-cleanup-after-each.js"
404+
const {cleanup} = require('@testing-library/react')
403405

404406
exports.mochaHooks = {
405407
afterEach() {
406-
cleanup();
408+
cleanup()
407409
},
408-
};
410+
}
409411
```
410412

411413
And register it using mocha's `-r` flag:

docs/svelte-testing-library/setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ with any testing framework and runner you're comfortable with.
7979
[jest-dom](https://github.com/testing-library/jest-dom) to add handy
8080
assertions to Jest
8181

82-
6.1 Install jest-dom
82+
6.1 Install `jest-dom`
8383

8484
```
8585
npm install --save-dev @testing-library/jest-dom

docs/testcafe-testing-library/intro.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ npm install --save-dev testcafe @testing-library/testcafe
2626
`testcafe-testing-library` provides custom Selectors allowing you to query the
2727
dom.
2828

29-
Add the following to your .testcaferc.json file:
29+
Add the following to your `.testcaferc.json` file:
3030

3131
```json
3232
"clientScripts": [
@@ -37,7 +37,9 @@ Add the following to your .testcaferc.json file:
3737
You can now import `screen` which has all the get[All]By*, query[All]By*,
3838
find[All]By\* selectors that you can use in your tests.
3939

40-
`import { screen } from '@testing-library/testcafe'`
40+
```js
41+
import {screen} from '@testing-library/testcafe'
42+
```
4143

4244
[See `Queries` for reference](queries/about.mdx)
4345

0 commit comments

Comments
 (0)