Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 498bef1

Browse files
committed
chore(matchers): improve output for toBeMarkedAsSelected
1 parent 17d34b7 commit 498bef1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/helpers/matchers.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,15 @@ beforeEach(function() {
365365
return {
366366
compare: function(actual) {
367367
var errors = [];
368+
var optionVal = toJson(actual.value);
369+
368370
if (actual.selected === null || typeof actual.selected === 'undefined' || actual.selected === false) {
369-
errors.push('Expected option property "selected" to be truthy');
371+
errors.push('Expected option with value ' + optionVal + ' to have property "selected" set to truthy');
370372
}
371373

372374
// Support: IE 9 only
373375
if (msie !== 9 && actual.hasAttribute('selected') === false) {
374-
errors.push('Expected option to have attribute "selected"');
376+
errors.push('Expected option with value ' + optionVal + ' to have attribute "selected"');
375377
}
376378

377379
var result = {
@@ -383,13 +385,15 @@ beforeEach(function() {
383385
},
384386
negativeCompare: function(actual) {
385387
var errors = [];
388+
var optionVal = toJson(actual.value);
389+
386390
if (actual.selected) {
387-
errors.push('Expected option property "selected" to be falsy');
391+
errors.push('Expected option with value ' + optionVal + ' property "selected" to be falsy');
388392
}
389393

390394
// Support: IE 9 only
391395
if (msie !== 9 && actual.hasAttribute('selected')) {
392-
errors.push('Expected option not to have attribute "selected"');
396+
errors.push('Expected option with value ' + optionVal + ' not to have attribute "selected"');
393397
}
394398

395399
var result = {

0 commit comments

Comments
 (0)