|
@@ -44,7 +44,6 @@ test('normalizing placeholder gives object for string', function (assert) {
|
|
assert.equal(normalized.text, 'placeholder');
|
|
assert.equal(normalized.text, 'placeholder');
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
test('text is shown for placeholder option on single', function (assert) {
|
|
test('text is shown for placeholder option on single', function (assert) {
|
|
var selection = new SinglePlaceholder(
|
|
var selection = new SinglePlaceholder(
|
|
$('#qunit-fixture .single'),
|
|
$('#qunit-fixture .single'),
|
|
@@ -60,6 +59,50 @@ test('text is shown for placeholder option on single', function (assert) {
|
|
assert.equal($selection.text(), 'This is the placeholder');
|
|
assert.equal($selection.text(), 'This is the placeholder');
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+test('title is set for placeholder option on single', function (assert) {
|
|
|
|
+ var selection = new SinglePlaceholder(
|
|
|
|
+ $('#qunit-fixture .single'),
|
|
|
|
+ placeholderOptions
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ var $selection = selection.render();
|
|
|
|
+
|
|
|
|
+ selection.update([{
|
|
|
|
+ id: 'placeholder'
|
|
|
|
+ }]);
|
|
|
|
+
|
|
|
|
+ assert.equal(
|
|
|
|
+ $selection.find('.select2-selection__rendered').attr('title'),
|
|
|
|
+ 'This is the placeholder'
|
|
|
|
+ );
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+test('title is used for placeholder option on single', function (assert) {
|
|
|
|
+ var placeholderTitleOptions = new Options({
|
|
|
|
+ placeholder: {
|
|
|
|
+ id: 'placeholder',
|
|
|
|
+ text: 'This is the placeholder',
|
|
|
|
+ title: 'This is the placeholder title'
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var selection = new SinglePlaceholder(
|
|
|
|
+ $('#qunit-fixture .single'),
|
|
|
|
+ placeholderTitleOptions
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ var $selection = selection.render();
|
|
|
|
+
|
|
|
|
+ selection.update([{
|
|
|
|
+ id: 'placeholder'
|
|
|
|
+ }]);
|
|
|
|
+
|
|
|
|
+ assert.equal(
|
|
|
|
+ $selection.find('.select2-selection__rendered').attr('title'),
|
|
|
|
+ 'This is the placeholder title'
|
|
|
|
+ );
|
|
|
|
+});
|
|
|
|
+
|
|
test('placeholder is shown when no options are selected', function (assert) {
|
|
test('placeholder is shown when no options are selected', function (assert) {
|
|
var selection = new SinglePlaceholder(
|
|
var selection = new SinglePlaceholder(
|
|
$('#qunit-fixture .multiple'),
|
|
$('#qunit-fixture .multiple'),
|