@@ -43,7 +43,7 @@ test('clear is not displayed for single placeholder', function (assert) {
4343
4444test ( 'clear is not displayed for multiple placeholder' , function ( assert ) {
4545 var selection = new AllowClearPlaceholder (
46- $ ( '#qunit-fixture .single-with-placeholder ' ) ,
46+ $ ( '#qunit-fixture .multiple ' ) ,
4747 allowClearOptions
4848 ) ;
4949
@@ -90,7 +90,7 @@ test('clicking clear will set the placeholder value', function (assert) {
9090
9191 var $selection = selection . render ( ) ;
9292
93- selection . bind ( container , $ ( '<div></div' ) ) ;
93+ selection . bind ( container , $ ( '<div></div> ' ) ) ;
9494
9595 $element . val ( 'One' ) ;
9696 selection . update ( [ {
@@ -109,7 +109,7 @@ test('clicking clear will set the placeholder value', function (assert) {
109109} ) ;
110110
111111test ( 'clicking clear will trigger the unselect event' , function ( assert ) {
112- assert . expect ( 3 ) ;
112+ assert . expect ( 4 ) ;
113113
114114 var $element = $ ( '#qunit-fixture .single-with-placeholder' ) ;
115115
@@ -121,7 +121,7 @@ test('clicking clear will trigger the unselect event', function (assert) {
121121
122122 var $selection = selection . render ( ) ;
123123
124- selection . bind ( container , $ ( '<div></div' ) ) ;
124+ selection . bind ( container , $ ( '<div></div> ' ) ) ;
125125
126126 $element . val ( 'One' ) ;
127127 selection . update ( [ {
@@ -143,16 +143,20 @@ test('clicking clear will trigger the unselect event', function (assert) {
143143 assert . equal (
144144 ev . data . id ,
145145 'One' ,
146- 'The previous object should be unselected'
146+ 'The data should be the unselected object'
147+ ) ;
148+
149+ assert . equal (
150+ $element . val ( ) ,
151+ 'placeholder' ,
152+ 'The previous value should be unselected'
147153 ) ;
148154 } ) ;
149155
150156 var $remove = $selection . find ( '.select2-selection__clear' ) ;
151157 $remove . trigger ( 'mousedown' ) ;
152158} ) ;
153159
154-
155-
156160test ( 'preventing the unselect event cancels the clearing' , function ( assert ) {
157161 var $element = $ ( '#qunit-fixture .single-with-placeholder' ) ;
158162
@@ -164,7 +168,7 @@ test('preventing the unselect event cancels the clearing', function (assert) {
164168
165169 var $selection = selection . render ( ) ;
166170
167- selection . bind ( container , $ ( '<div></div' ) ) ;
171+ selection . bind ( container , $ ( '<div></div> ' ) ) ;
168172
169173 $element . val ( 'One' ) ;
170174 selection . update ( [ {
@@ -197,7 +201,7 @@ test('clear does not work when disabled', function (assert) {
197201
198202 var $selection = selection . render ( ) ;
199203
200- selection . bind ( container , $ ( '<div></div' ) ) ;
204+ selection . bind ( container , $ ( '<div></div> ' ) ) ;
201205
202206 selection . update ( [ {
203207 id : 'One' ,
0 commit comments