Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit f31a93a

Browse files
author
Gabriel Schulhof
committed
Textinput: Test destruction
1 parent cb1f649 commit f31a93a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/unit/textinput/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<script src="../../../external/requirejs/require.js"></script>
99
<script src="../../../js/requirejs.config.js"></script>
1010
<script src="../../../js/jquery.tag.inserter.js"></script>
11+
<script src="../../jquery.setNameSpace.js"></script>
1112
<script src="../../../external/qunit/qunit.js"></script>
1213
<script src="../../../tests/jquery.testHelper.js"></script>
1314
<script src="../../../tests/jquery.setNameSpace.js"></script>
@@ -70,6 +71,9 @@
7071
<input type="text" id="focus-class-test-for-input"></input>
7172
<textarea id="focus-class-test-for-textarea"></textarea>
7273
<input id="injection-test" data-nstest-clear-btn="true" data-nstest-clear-btn-text="'>a<script>$.clearBtnTextScriptInjected = true;</script>bc</a><a'">
74+
<div id="destroy-test-container">
75+
<input type="text" id="destroy-test" data-nstest-role="none"></input>
76+
</div>
7377
</div>
7478
</body>
7579
</html>

tests/unit/textinput/textinput_core.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,14 @@
169169
"no script was injected via clearBtnText option" );
170170
});
171171

172+
test( "textinput is destroyed correctly", function() {
173+
var originalDOM = $( "#destroy-test-container" ).clone(),
174+
entry = $( "#destroy-test" );
175+
176+
entry.textinput().textinput( "destroy" );
177+
178+
deepEqual( $.testHelper.domEqual( originalDOM, $( "#destroy-test-container" ) ), true,
179+
"Original DOM is restored after textinput destruction" );
180+
});
181+
172182
})(jQuery);

0 commit comments

Comments
 (0)