@@ -214,7 +214,11 @@ main() {
214
214
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=324360
215
215
test (type, () {
216
216
sharedInputSetSelectionRangeTest (type);
217
- }, testOn: 'js && !chrome' );
217
+
218
+ // Tests run in `ddev coverage` don't respect tags and show up as the 'vm' platform
219
+ // so we can use this to disable certain browser tests during coverage.
220
+ // Workaround for https://github.com/Workiva/dart_dev/issues/200
221
+ }, testOn: '!(blink || firefox || vm)' );
218
222
} else {
219
223
test (type, () { sharedInputSetSelectionRangeTest (type); });
220
224
}
@@ -233,7 +237,7 @@ main() {
233
237
});
234
238
235
239
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=324360
236
- group ('without throwing an error in Google Chrome when `props.type` is' , () {
240
+ group ('without throwing an error in Google Chrome (or Dartium/content_shell) or Firefox when `props.type` is' , () {
237
241
void verifyLackOfException () {
238
242
expect (renderedInstance, isNotNull, reason: 'test setup sanity check' );
239
243
expect (inputElement, isNotNull, reason: 'test setup sanity check' );
@@ -266,7 +270,7 @@ main() {
266
270
inputElement = findDomNode (renderedInstance);
267
271
verifyLackOfException ();
268
272
});
269
- }, testOn: 'chrome ' );
273
+ }, testOn: 'blink || firefox ' );
270
274
});
271
275
});
272
276
@@ -301,23 +305,33 @@ main() {
301
305
});
302
306
303
307
group ('for an `<input>` of type:' , () {
304
- void sharedInputGetSelectionStartTest (String type) {
308
+ void sharedInputGetSelectionStartTest (String type, { bool shouldReturnNull : false } ) {
305
309
renderedInstance = renderAttachedToDocument ((Dom .input ()
306
310
..defaultValue = testValue
307
311
..type = type
308
312
)());
309
313
inputElement = findDomNode (renderedInstance);
314
+ setSelectionRange (inputElement, testValue.length, testValue.length);
315
+
310
316
var selectionStart = getSelectionStart (inputElement);
311
317
312
- expect (selectionStart, testValue.length);
318
+ expect (selectionStart, shouldReturnNull ? isNull : testValue.length);
313
319
}
314
320
315
321
for (var type in inputTypesWithSelectionRangeSupport) {
316
322
if (type == 'email' || type == 'number' ) {
317
323
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=324360
324
+ test ('$type , returning null in Google Chrome (or Dartium/content_shell) or Firefox' , () {
325
+ sharedInputGetSelectionStartTest (type, shouldReturnNull: true );
326
+ }, testOn: 'blink || firefox' );
327
+
318
328
test (type, () {
319
- sharedInputGetSelectionStartTest (type);
320
- }, testOn: 'js && !chrome' );
329
+ sharedInputGetSelectionStartTest (type, shouldReturnNull: false );
330
+
331
+ // Tests run in `ddev coverage` don't respect tags and show up as the 'vm' platform
332
+ // so we can use this to disable certain browser tests during coverage.
333
+ // Workaround for https://github.com/Workiva/dart_dev/issues/200
334
+ }, testOn: '!(blink || firefox || vm)' );
321
335
} else {
322
336
test (type, () { sharedInputGetSelectionStartTest (type); });
323
337
}
@@ -337,7 +351,7 @@ main() {
337
351
});
338
352
339
353
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=324360
340
- group ('by returning null and not throwing an error in Google Chrome when `props.type` is' , () {
354
+ group ('by returning null and not throwing an error in Google Chrome (or Dartium/content_shell) or Firefox when `props.type` is' , () {
341
355
void verifyReturnsNullWithoutException () {
342
356
expect (renderedInstance, isNotNull, reason: 'test setup sanity check' );
343
357
expect (inputElement, isNotNull, reason: 'test setup sanity check' );
@@ -366,7 +380,7 @@ main() {
366
380
inputElement = findDomNode (renderedInstance);
367
381
verifyReturnsNullWithoutException ();
368
382
});
369
- }, testOn: 'chrome ' );
383
+ }, testOn: 'blink || firefox ' );
370
384
});
371
385
});
372
386
}
0 commit comments