Skip to content

Commit bd5d8d6

Browse files
committed
chore: Rename selector to selectorString in ErrorWrapper
1 parent 99336c4 commit bd5d8d6

File tree

2 files changed

+41
-37
lines changed

2 files changed

+41
-37
lines changed

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

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,56 @@
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(
2022
`find did not return ${
21-
this.selector
23+
this.selectorString
2224
}, cannot call attributes() on empty Wrapper`
2325
)
2426
}
2527

2628
classes(): void {
2729
throwError(
2830
`find did not return ${
29-
this.selector
31+
this.selectorString
3032
}, cannot call classes() on empty Wrapper`
3133
)
3234
}
3335

3436
contains(): void {
3537
throwError(
3638
`find did not return ${
37-
this.selector
39+
this.selectorString
3840
}, cannot call contains() on empty Wrapper`
3941
)
4042
}
4143

4244
emitted(): void {
4345
throwError(
4446
`find did not return ${
45-
this.selector
47+
this.selectorString
4648
}, cannot call emitted() on empty Wrapper`
4749
)
4850
}
4951

5052
emittedByOrder(): void {
5153
throwError(
5254
`find did not return ${
53-
this.selector
55+
this.selectorString
5456
}, cannot call emittedByOrder() on empty Wrapper`
5557
)
5658
}
@@ -62,197 +64,199 @@ export default class ErrorWrapper implements BaseWrapper {
6264
filter(): void {
6365
throwError(
6466
`find did not return ${
65-
this.selector
67+
this.selectorString
6668
}, cannot call filter() on empty Wrapper`
6769
)
6870
}
6971

7072
visible(): void {
7173
throwError(
7274
`find did not return ${
73-
this.selector
75+
this.selectorString
7476
}, cannot call visible() on empty Wrapper`
7577
)
7678
}
7779

7880
hasAttribute(): void {
7981
throwError(
8082
`find did not return ${
81-
this.selector
83+
this.selectorString
8284
}, cannot call hasAttribute() on empty Wrapper`
8385
)
8486
}
8587

8688
hasClass(): void {
8789
throwError(
8890
`find did not return ${
89-
this.selector
91+
this.selectorString
9092
}, cannot call hasClass() on empty Wrapper`
9193
)
9294
}
9395

9496
hasProp(): void {
9597
throwError(
9698
`find did not return ${
97-
this.selector
99+
this.selectorString
98100
}, cannot call hasProp() on empty Wrapper`
99101
)
100102
}
101103

102104
hasStyle(): void {
103105
throwError(
104106
`find did not return ${
105-
this.selector
107+
this.selectorString
106108
}, cannot call hasStyle() on empty Wrapper`
107109
)
108110
}
109111

110112
findAll(): void {
111113
throwError(
112114
`find did not return ${
113-
this.selector
115+
this.selectorString
114116
}, cannot call findAll() on empty Wrapper`
115117
)
116118
}
117119

118120
find(): void {
119121
throwError(
120122
`find did not return ${
121-
this.selector
123+
this.selectorString
122124
}, cannot call find() on empty Wrapper`
123125
)
124126
}
125127

126128
html(): void {
127129
throwError(
128130
`find did not return ${
129-
this.selector
131+
this.selectorString
130132
}, cannot call html() on empty Wrapper`
131133
)
132134
}
133135

134136
is(): void {
135137
throwError(
136-
`find did not return ${this.selector}, cannot call is() on empty Wrapper`
138+
`find did not return ${
139+
this.selectorString
140+
}, cannot call is() on empty Wrapper`
137141
)
138142
}
139143

140144
isEmpty(): void {
141145
throwError(
142146
`find did not return ${
143-
this.selector
147+
this.selectorString
144148
}, cannot call isEmpty() on empty Wrapper`
145149
)
146150
}
147151

148152
isVisible(): void {
149153
throwError(
150154
`find did not return ${
151-
this.selector
155+
this.selectorString
152156
}, cannot call isVisible() on empty Wrapper`
153157
)
154158
}
155159

156160
isVueInstance(): void {
157161
throwError(
158162
`find did not return ${
159-
this.selector
163+
this.selectorString
160164
}, cannot call isVueInstance() on empty Wrapper`
161165
)
162166
}
163167

164168
name(): void {
165169
throwError(
166170
`find did not return ${
167-
this.selector
171+
this.selectorString
168172
}, cannot call name() on empty Wrapper`
169173
)
170174
}
171175

172176
props(): void {
173177
throwError(
174178
`find did not return ${
175-
this.selector
179+
this.selectorString
176180
}, cannot call props() on empty Wrapper`
177181
)
178182
}
179183

180184
text(): void {
181185
throwError(
182186
`find did not return ${
183-
this.selector
187+
this.selectorString
184188
}, cannot call text() on empty Wrapper`
185189
)
186190
}
187191

188192
setComputed(): void {
189193
throwError(
190194
`find did not return ${
191-
this.selector
195+
this.selectorString
192196
}, cannot call setComputed() on empty Wrapper`
193197
)
194198
}
195199

196200
setData(): void {
197201
throwError(
198202
`find did not return ${
199-
this.selector
203+
this.selectorString
200204
}, cannot call setData() on empty Wrapper`
201205
)
202206
}
203207

204208
setMethods(): void {
205209
throwError(
206210
`find did not return ${
207-
this.selector
211+
this.selectorString
208212
}, cannot call setMethods() on empty Wrapper`
209213
)
210214
}
211215

212216
setProps(): void {
213217
throwError(
214218
`find did not return ${
215-
this.selector
219+
this.selectorString
216220
}, cannot call setProps() on empty Wrapper`
217221
)
218222
}
219223

220224
setValue(): void {
221225
throwError(
222226
`find did not return ${
223-
this.selector
227+
this.selectorString
224228
}, cannot call setValue() on empty Wrapper`
225229
)
226230
}
227231

228232
setChecked(): void {
229233
throwError(
230234
`find did not return ${
231-
this.selector
235+
this.selectorString
232236
}, cannot call setChecked() on empty Wrapper`
233237
)
234238
}
235239

236240
setSelected(): void {
237241
throwError(
238242
`find did not return ${
239-
this.selector
243+
this.selectorString
240244
}, cannot call setSelected() on empty Wrapper`
241245
)
242246
}
243247

244248
trigger(): void {
245249
throwError(
246250
`find did not return ${
247-
this.selector
251+
this.selectorString
248252
}, cannot call trigger() on empty Wrapper`
249253
)
250254
}
251255

252256
destroy(): void {
253257
throwError(
254258
`find did not return ${
255-
this.selector
259+
this.selectorString
256260
}, cannot call destroy() on empty Wrapper`
257261
)
258262
}

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)