Skip to content

Commit

Permalink
Merge pull request #23 from Turbo87/empty-value
Browse files Browse the repository at this point in the history
tests/has-value: Ensure empty `value` does not break the assertion
  • Loading branch information
Turbo87 authored Oct 10, 2017
2 parents 116ded8 + 5c11905 commit afd2039
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/__tests__/has-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ describe('assert.dom(...).hasValue()', () => {
result: false,
}]);
});

test('fails for wrong content if field is empty', () => {
document.body.innerHTML = '<input>';

assert.dom('input').hasValue('Bart');
assert.dom(document.querySelector('input')).hasValue('Bart');

expect(assert.results).toEqual([{
actual: '',
expected: 'Bart',
message: 'Element input has value "Bart"',
result: false,
}, {
actual: '',
expected: 'Bart',
message: 'Element input has value "Bart"',
result: false,
}]);
});
});

describe('regex expected', () => {
Expand Down

0 comments on commit afd2039

Please sign in to comment.