Skip to content

Commit 967a638

Browse files
authored
fix: 测试工具,查询相关的代码案例错误 (#250)
1 parent e28daed commit 967a638

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/test-utils/queries.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function querySelector(selectors: string): HTMLElement
3030
用法:
3131

3232
```js
33-
const btns = testUtils.querySelectorAll('.btns')
33+
const btns = testUtils.queries.querySelectorAll('.btns')
3434
```
3535

3636
### querySelectorAll
@@ -48,7 +48,7 @@ function querySelectorAll(selectors: string): HTMLElement[]
4848
用法:
4949

5050
```js
51-
const btns = testUtils.querySelectorAll('.btns')
51+
const btns = testUtils.queries.querySelectorAll('.btns')
5252
```
5353

5454
### waitForQuerySelector
@@ -67,7 +67,7 @@ async function waitForQuerySelector(selectors: string, params?: TParams): Promis
6767
用法:
6868

6969
```js
70-
const btn = await testUtils.waitForQuerySelector('.async-btn')
70+
const btn = await testUtils.queries.waitForQuerySelector('.async-btn')
7171
```
7272

7373
### waitForQuerySelectorAll
@@ -86,7 +86,7 @@ async function waitForQuerySelectorAll(selectors: string, params?: TParams): Pro
8686
用法:
8787

8888
```js
89-
const btns = await testUtils.waitForQuerySelectorAll('.async-btns')
89+
const btns = await testUtils.queries.waitForQuerySelectorAll('.async-btns')
9090
```
9191

9292
## 按照文本查询
@@ -108,7 +108,7 @@ function queryByText(text: string, selector?: string): HTMLElement
108108

109109
```js
110110
// <Text>Hello World!!!</Text>
111-
const textView = testUtils.queryByText('Hello World')
111+
const textView = testUtils.queries.queryByText('Hello World')
112112
```
113113

114114
### queryByTextAll
@@ -129,7 +129,7 @@ function queryAllByText(text: string, selector?: string): HTMLElement[]
129129
```js
130130
// <Text>Hello World!!</Text>
131131
// <View>Hello World!!!</View>
132-
const textViews = testUtils.queryAllByText('Hello World')
132+
const textViews = testUtils.queries.queryAllByText('Hello World')
133133
```
134134

135135
### waitForQueryByText
@@ -150,7 +150,7 @@ async function waitForQueryByText(text: string, selector?: string, params?: TWai
150150

151151
```js
152152
// <Text>Hello World!!!</Text>
153-
const textView = async testUtils.waitForQueryByText("Hello World");
153+
const textView = async testUtils.queries.waitForQueryByText("Hello World");
154154
```
155155

156156
### waitForQueryAllByText
@@ -172,7 +172,7 @@ async function waitForQueryAllByText(text: string, selector?: string, params?: T
172172
```js
173173
// <Text>Hello World!!</Text>
174174
// <View>Hello World!!!</View>
175-
const textViews = async testUtils.waitForQueryAllByText("Hello World");
175+
const textViews = async testUtils.queries.waitForQueryAllByText("Hello World");
176176
```
177177

178178
## 按照 Placeholder 查询
@@ -193,7 +193,7 @@ function queryByPlaceholder(text: string): HTMLElement
193193

194194
```js
195195
// <input placeholder="hello" />
196-
const input = testUtils.queryByPlaceholder('hello')
196+
const input = testUtils.queries.queryByPlaceholder('hello')
197197
```
198198

199199
### queryAllByPlaceholder
@@ -213,7 +213,7 @@ function queryAllByPlaceholder(text: string): HTMLElement[]
213213
```js
214214
// <input placeholder="hello" />
215215
// <input placeholder="hello" />
216-
const inputs = testUtils.queryAllByPlaceholder('hello')
216+
const inputs = testUtils.queries.queryAllByPlaceholder('hello')
217217
```
218218

219219
### waitForQueryByPlaceholder
@@ -233,7 +233,7 @@ async function waitForQueryByPlaceholder(text: string, params?: TParams): Promis
233233

234234
```js
235235
// <input placeholder="async-placeholde" />
236-
const input = await testUtils.waitForQueryByPlaceholder('async-placeholder')
236+
const input = await testUtils.queries.waitForQueryByPlaceholder('async-placeholder')
237237
```
238238

239239
### waitForQueryAllByPlaceholder
@@ -254,7 +254,7 @@ async function waitForQueryAllByPlaceholder(text: string, params?: TParams): Pro
254254
```js
255255
// <input placeholder="async-placeholde" />
256256
// <input placeholder="async-placeholde" />
257-
const inputs = await testUtils.waitForQueryAllByPlaceholder('async-placeholder')
257+
const inputs = await testUtils.queries.waitForQueryAllByPlaceholder('async-placeholder')
258258
```
259259

260260
## 按照属性查询
@@ -276,7 +276,7 @@ function queryByAttribute(attr: string, value: any): HTMLElement
276276

277277
```js
278278
// <div key="value" />
279-
const view = testUtils.queryByAttribute('key', 'value')
279+
const view = testUtils.queries.queryByAttribute('key', 'value')
280280
```
281281

282282
### queryAllByAttribute
@@ -297,7 +297,7 @@ function queryAllByAttribute(attr: string, value: any): HTMLElement[]
297297
```js
298298
// <div key="value" />
299299
// <div key="value" />
300-
const view = testUtils.queryAllByAttribute('key', 'value')
300+
const view = testUtils.queries.queryAllByAttribute('key', 'value')
301301
```
302302

303303
### waitForQueryByAttribute
@@ -318,7 +318,7 @@ async function waitForQueryByAttribute(attr: string, value: string, params?: TPa
318318

319319
```js
320320
// <div key="value" />
321-
const view = await testUtils.waitForQueryByAttribute('key', 'value')
321+
const view = await testUtils.queries.waitForQueryByAttribute('key', 'value')
322322
```
323323

324324
### waitForQueryAllByAttribute
@@ -340,5 +340,5 @@ async function waitForQueryAllByAttribute(attr: string, value: string, params?:
340340
```js
341341
// <div key="value" />
342342
// <div key="value" />
343-
const inputs = await testUtils.waitForQueryAllByAttribute('key', 'value')
343+
const inputs = await testUtils.queries.waitForQueryAllByAttribute('key', 'value')
344344
```

0 commit comments

Comments
 (0)