Skip to content

Commit dcd31d3

Browse files
committed
Add test coverage for setAttribute update.
1 parent 162eee8 commit dcd31d3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js

+12
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,18 @@ describe('DOMPropertyOperations', function() {
346346
expect(stubNode.className).toBe('');
347347
});
348348

349+
it('should not update numeric values when the input.value is loosely the same', function() {
350+
stubNode.setAttribute('type', 'number');
351+
stubNode.setAttribute('value', '3e1');
352+
// Keep in sync. The comparison occurs between setAttribute and value.
353+
stubNode.value = '3e1';
354+
355+
spyOn(stubNode, 'setAttribute');
356+
357+
DOMPropertyOperations.setValueForProperty(stubNode, 'value', 30);
358+
359+
expect(stubNode.setAttribute.calls.count()).toBe(0);
360+
});
349361
});
350362

351363
describe('deleteValueForProperty', function() {

0 commit comments

Comments
 (0)