mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-26 09:20:10 +02:00
Add custom property tests
This commit is contained in:
parent
61f02034a7
commit
897745fcba
|
@ -166,6 +166,11 @@
|
|||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div data-test-hook="custom-properties">
|
||||
<label for="choices-custom-properties">Custom properties</label>
|
||||
<select class="form-control" name="choices-custom-properties" id="choices-custom-properties" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -225,6 +230,36 @@
|
|||
});
|
||||
|
||||
new Choices('#choices-groups');
|
||||
|
||||
new Choices('#choices-custom-properties', {
|
||||
searchFields: ['label', 'value', 'customProperties.country'],
|
||||
choices: [
|
||||
{
|
||||
id: 1,
|
||||
value: 'London',
|
||||
label: 'London',
|
||||
customProperties: {
|
||||
country: 'United Kingdom',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: 'Berlin',
|
||||
label: 'Berlin',
|
||||
customProperties: {
|
||||
country: 'Germany',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
value: 'Lisbon',
|
||||
label: 'Lisbon',
|
||||
customProperties: {
|
||||
country: 'Portugal',
|
||||
},
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -170,6 +170,11 @@
|
|||
<option value="Child choice 3">Child choice 3</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div data-test-hook="custom-properties">
|
||||
<label for="choices-custom-properties">Custom properties</label>
|
||||
<select class="form-control" name="choices-custom-properties" id="choices-custom-properties"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -237,6 +242,36 @@
|
|||
child.disable();
|
||||
}
|
||||
});
|
||||
|
||||
new Choices('#choices-custom-properties', {
|
||||
searchFields: ['label', 'value', 'customProperties.country'],
|
||||
choices: [
|
||||
{
|
||||
id: 1,
|
||||
value: 'London',
|
||||
label: 'London',
|
||||
customProperties: {
|
||||
country: 'United Kingdom',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: 'Berlin',
|
||||
label: 'Berlin',
|
||||
customProperties: {
|
||||
country: 'Germany',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
value: 'Lisbon',
|
||||
label: 'Lisbon',
|
||||
customProperties: {
|
||||
country: 'Portugal',
|
||||
},
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue