Skip to content

Commit f156698

Browse files
committed
chore: Rename selector to selectorString in ErrorWrapper
1 parent a05b499 commit f156698

File tree

2 files changed

+101
-37
lines changed

2 files changed

+101
-37
lines changed

packages/test-utils/src/error-wrapper.js

Lines changed: 98 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,59 @@
33
import { throwError } from 'shared/util'
44

55
export default class ErrorWrapper implements BaseWrapper {
6-
selector: string
6+
selectorString: string
77

8-
constructor(selector: string) {
9-
this.selector = selector
8+
constructor(selectorString: string) {
9+
this.selectorString = selectorString
1010
}
1111

1212
at(): void {
1313
throwError(
14-
`find did not return ${this.selector}, cannot call at() on empty Wrapper`
14+
`find did not return ${
15+
this.selectorString
16+
}, cannot call at() on empty Wrapper`
1517
)
1618
}
1719

1820
attributes(): void {
1921
throwError(
20-
`find did not return ${this.selector}, cannot call attributes() on empty Wrapper`
22+
`find did not return ${
23+
this.selectorString
24+
}, cannot call attributes() on empty Wrapper`
25+
2126
)
2227
}
2328

2429
classes(): void {
2530
throwError(
26-
`find did not return ${this.selector}, cannot call classes() on empty Wrapper`
31+
`find did not return ${
32+
this.selectorString
33+
}, cannot call classes() on empty Wrapper`
34+
2735
)
2836
}
2937

3038
contains(): void {
3139
throwError(
32-
`find did not return ${this.selector}, cannot call contains() on empty Wrapper`
40+
`find did not return ${
41+
this.selectorString
42+
}, cannot call contains() on empty Wrapper`
3343
)
3444
}
3545

3646
emitted(): void {
3747
throwError(
38-
`find did not return ${this.selector}, cannot call emitted() on empty Wrapper`
48+
`find did not return ${
49+
this.selectorString
50+
}, cannot call emitted() on empty Wrapper`
3951
)
4052
}
4153

4254
emittedByOrder(): void {
4355
throwError(
44-
`find did not return ${this.selector}, cannot call emittedByOrder() on empty Wrapper`
56+
`find did not return ${
57+
this.selectorString
58+
}, cannot call emittedByOrder() on empty Wrapper`
4559
)
4660
}
4761

@@ -51,151 +65,201 @@ export default class ErrorWrapper implements BaseWrapper {
5165

5266
filter(): void {
5367
throwError(
54-
`find did not return ${this.selector}, cannot call filter() on empty Wrapper`
68+
`find did not return ${
69+
this.selectorString
70+
}, cannot call filter() on empty Wrapper`
5571
)
5672
}
5773

5874
visible(): void {
5975
throwError(
60-
`find did not return ${this.selector}, cannot call visible() on empty Wrapper`
76+
`find did not return ${
77+
this.selectorString
78+
}, cannot call visible() on empty Wrapper`
6179
)
6280
}
6381

6482
hasAttribute(): void {
6583
throwError(
66-
`find did not return ${this.selector}, cannot call hasAttribute() on empty Wrapper`
84+
`find did not return ${
85+
this.selectorString
86+
}, cannot call hasAttribute() on empty Wrapper`
6787
)
6888
}
6989

7090
hasClass(): void {
7191
throwError(
72-
`find did not return ${this.selector}, cannot call hasClass() on empty Wrapper`
92+
`find did not return ${
93+
this.selectorString
94+
}, cannot call hasClass() on empty Wrapper`
7395
)
7496
}
7597

7698
hasProp(): void {
7799
throwError(
78-
`find did not return ${this.selector}, cannot call hasProp() on empty Wrapper`
100+
`find did not return ${
101+
this.selectorString
102+
}, cannot call hasProp() on empty Wrapper`
79103
)
80104
}
81105

82106
hasStyle(): void {
83107
throwError(
84-
`find did not return ${this.selector}, cannot call hasStyle() on empty Wrapper`
108+
`find did not return ${
109+
this.selectorString
110+
}, cannot call hasStyle() on empty Wrapper`
85111
)
86112
}
87113

88114
findAll(): void {
89115
throwError(
90-
`find did not return ${this.selector}, cannot call findAll() on empty Wrapper`
116+
`find did not return ${
117+
this.selectorString
118+
}, cannot call findAll() on empty Wrapper`
91119
)
92120
}
93121

94122
find(): void {
95123
throwError(
96-
`find did not return ${this.selector}, cannot call find() on empty Wrapper`
124+
`find did not return ${
125+
this.selectorString
126+
}, cannot call find() on empty Wrapper`
97127
)
98128
}
99129

100130
html(): void {
101131
throwError(
102-
`find did not return ${this.selector}, cannot call html() on empty Wrapper`
132+
`find did not return ${
133+
this.selectorString
134+
}, cannot call html() on empty Wrapper`
103135
)
104136
}
105137

106138
is(): void {
107139
throwError(
108-
`find did not return ${this.selector}, cannot call is() on empty Wrapper`
140+
`find did not return ${
141+
this.selectorString
142+
}, cannot call is() on empty Wrapper`
109143
)
110144
}
111145

112146
isEmpty(): void {
113147
throwError(
114-
`find did not return ${this.selector}, cannot call isEmpty() on empty Wrapper`
148+
`find did not return ${
149+
this.selectorString
150+
}, cannot call isEmpty() on empty Wrapper`
115151
)
116152
}
117153

118154
isVisible(): void {
119155
throwError(
120-
`find did not return ${this.selector}, cannot call isVisible() on empty Wrapper`
156+
`find did not return ${
157+
this.selectorString
158+
}, cannot call isVisible() on empty Wrapper`
121159
)
122160
}
123161

124162
isVueInstance(): void {
125163
throwError(
126-
`find did not return ${this.selector}, cannot call isVueInstance() on empty Wrapper`
164+
`find did not return ${
165+
this.selectorString
166+
}, cannot call isVueInstance() on empty Wrapper`
127167
)
128168
}
129169

130170
name(): void {
131171
throwError(
132-
`find did not return ${this.selector}, cannot call name() on empty Wrapper`
172+
`find did not return ${
173+
this.selectorString
174+
}, cannot call name() on empty Wrapper`
133175
)
134176
}
135177

136178
props(): void {
137179
throwError(
138-
`find did not return ${this.selector}, cannot call props() on empty Wrapper`
180+
`find did not return ${
181+
this.selectorString
182+
}, cannot call props() on empty Wrapper`
139183
)
140184
}
141185

142186
text(): void {
143187
throwError(
144-
`find did not return ${this.selector}, cannot call text() on empty Wrapper`
188+
`find did not return ${
189+
this.selectorString
190+
}, cannot call text() on empty Wrapper`
145191
)
146192
}
147193

148194
setComputed(): void {
149195
throwError(
150-
`find did not return ${this.selector}, cannot call setComputed() on empty Wrapper`
196+
`find did not return ${
197+
this.selectorString
198+
}, cannot call setComputed() on empty Wrapper`
151199
)
152200
}
153201

154202
setData(): void {
155203
throwError(
156-
`find did not return ${this.selector}, cannot call setData() on empty Wrapper`
204+
`find did not return ${
205+
this.selectorString
206+
}, cannot call setData() on empty Wrapper`
157207
)
158208
}
159209

160210
setMethods(): void {
161211
throwError(
162-
`find did not return ${this.selector}, cannot call setMethods() on empty Wrapper`
212+
`find did not return ${
213+
this.selectorString
214+
}, cannot call setMethods() on empty Wrapper`
163215
)
164216
}
165217

166218
setProps(): void {
167219
throwError(
168-
`find did not return ${this.selector}, cannot call setProps() on empty Wrapper`
220+
`find did not return ${
221+
this.selectorString
222+
}, cannot call setProps() on empty Wrapper`
169223
)
170224
}
171225

172226
setValue(): void {
173227
throwError(
174-
`find did not return ${this.selector}, cannot call setValue() on empty Wrapper`
228+
`find did not return ${
229+
this.selectorString
230+
}, cannot call setValue() on empty Wrapper`
175231
)
176232
}
177233

178234
setChecked(): void {
179235
throwError(
180-
`find did not return ${this.selector}, cannot call setChecked() on empty Wrapper`
236+
`find did not return ${
237+
this.selectorString
238+
}, cannot call setChecked() on empty Wrapper`
181239
)
182240
}
183241

184242
setSelected(): void {
185243
throwError(
186-
`find did not return ${this.selector}, cannot call setSelected() on empty Wrapper`
244+
`find did not return ${
245+
this.selectorString
246+
}, cannot call setSelected() on empty Wrapper`
187247
)
188248
}
189249

190250
trigger(): void {
191251
throwError(
192-
`find did not return ${this.selector}, cannot call trigger() on empty Wrapper`
252+
`find did not return ${
253+
this.selectorString
254+
}, cannot call trigger() on empty Wrapper`
193255
)
194256
}
195257

196258
destroy(): void {
197259
throwError(
198-
`find did not return ${this.selector}, cannot call destroy() on empty Wrapper`
260+
`find did not return ${
261+
this.selectorString
262+
}, cannot call destroy() on empty Wrapper`
199263
)
200264
}
201265
}

test/specs/wrapper/find.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,14 @@ describeWithShallowAndMount('find', mountingMethod => {
363363
const selector = 'pre'
364364
const error = wrapper.find(selector)
365365
expect(error.exists()).to.equal(false)
366-
expect(error.selector).to.equal(selector)
366+
expect(error.selectorString).to.equal(selector)
367367
})
368368

369369
it('returns empty Wrapper with error if no nodes are found when passed a component', () => {
370370
const wrapper = mountingMethod(Component)
371371
const error = wrapper.find(ComponentWithChild)
372372
expect(error.exists()).to.equal(false)
373-
expect(error.selector).to.equal('Component')
373+
expect(error.selectorString).to.equal('Component')
374374
})
375375

376376
it('returns Wrapper of elements matching the ref in options object', () => {
@@ -460,7 +460,7 @@ describeWithShallowAndMount('find', mountingMethod => {
460460
const wrapper = mountingMethod(Component)
461461
const error = wrapper.find({ ref: 'foo' })
462462
expect(error.exists()).to.equal(false)
463-
expect(error.selector).to.equal('ref="foo"')
463+
expect(error.selectorString).to.equal('ref="foo"')
464464
})
465465

466466
it('returns Wrapper matching component that has no name property', () => {

0 commit comments

Comments
 (0)