mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-05 23:33:12 +02:00
Add plcaeholder tests
This commit is contained in:
parent
544763017e
commit
69ee88ae88
|
@ -197,7 +197,6 @@ describe('Choices - select multiple', () => {
|
|||
removeItemButton: true,
|
||||
};
|
||||
*/
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('[data-test-hook=remove-button]')
|
||||
.find('.choices__input--cloned')
|
||||
|
@ -259,7 +258,6 @@ describe('Choices - select multiple', () => {
|
|||
maxItemCount: 5,
|
||||
};
|
||||
*/
|
||||
|
||||
const selectionLimit = 5;
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -347,7 +345,6 @@ describe('Choices - select multiple', () => {
|
|||
renderChoiceLimit: 1,
|
||||
};
|
||||
*/
|
||||
|
||||
it('only displays given number of choices in the dropdown', () => {
|
||||
cy.get('[data-test-hook=render-choice-limit]')
|
||||
.find('.choices__list--dropdown .choices__list')
|
||||
|
@ -401,5 +398,21 @@ describe('Choices - select multiple', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('placeholder', () => {
|
||||
/*
|
||||
{
|
||||
placeholder: true,
|
||||
placeholderValue: 'I am a placeholder',
|
||||
}
|
||||
*/
|
||||
describe('when no value has been inputted', () => {
|
||||
it('displays a placeholder', () => {
|
||||
cy.get('[data-test-hook=placeholder]')
|
||||
.find('.choices__input--cloned')
|
||||
.should('have.attr', 'placeholder', 'I am a placeholder');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -283,5 +283,21 @@ describe('Choices - text element', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('placeholder', () => {
|
||||
/*
|
||||
{
|
||||
placeholder: true,
|
||||
placeholderValue: 'I am a placeholder',
|
||||
}
|
||||
*/
|
||||
describe('when no value has been inputted', () => {
|
||||
it('displays a placeholder', () => {
|
||||
cy.get('[data-test-hook=placeholder]')
|
||||
.find('.choices__input--cloned')
|
||||
.should('have.attr', 'placeholder', 'I am a placeholder');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<h2>Select multiple inputs</h2>
|
||||
<div data-test-hook="basic">
|
||||
<label for="choices-basic">Basic</label>
|
||||
<select class="form-control" name="choices-basic" id="choices-basic" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-basic" id="choices-basic" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Find me">Dropdown item 3</option>
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
<div data-test-hook="remove-button">
|
||||
<label for="choices-remove-button">Remove button</label>
|
||||
<select class="form-control" name="choices-remove-button" id="choices-remove-button" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-remove-button" id="choices-remove-button" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
<div data-test-hook="disabled-choice">
|
||||
<label for="choices-disabled-choice">Disabled choice</label>
|
||||
<select class="form-control" name="choices-disabled-choice" id="choices-disabled-choice" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-disabled-choice" id="choices-disabled-choice" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
<div data-test-hook="selection-limit">
|
||||
<label for="choices-selection-limit">Input limit</label>
|
||||
<select class="form-control" name="choices-selection-limit" id="choices-selection-limit" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-selection-limit" id="choices-selection-limit" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -73,7 +73,7 @@
|
|||
|
||||
<div data-test-hook="prepend-append">
|
||||
<label for="choices-prepend-append">Prepend/append</label>
|
||||
<select class="form-control" name="choices-prepend-append" id="choices-prepend-append" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-prepend-append" id="choices-prepend-append" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -82,7 +82,7 @@
|
|||
|
||||
<div data-test-hook="render-choice-limit">
|
||||
<label for="choices-render-choice-limit">Render choice limit</label>
|
||||
<select class="form-control" name="choices-render-choice-limit" id="choices-render-choice-limit" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-render-choice-limit" id="choices-render-choice-limit" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -91,7 +91,16 @@
|
|||
|
||||
<div data-test-hook="search-floor">
|
||||
<label for="choices-search-floor">Search floor</label>
|
||||
<select class="form-control" name="choices-search-floor" id="choices-search-floor" placeholder="This is a placeholder" multiple>
|
||||
<select class="form-control" name="choices-search-floor" id="choices-search-floor" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div data-test-hook="placeholder">
|
||||
<label for="choices-placeholder">Search floor</label>
|
||||
<select class="form-control" name="choices-placeholder" id="choices-placeholder" multiple>
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -125,6 +134,11 @@
|
|||
new Choices('#choices-search-floor', {
|
||||
searchFloor: 10,
|
||||
});
|
||||
|
||||
new Choices('#choices-placeholder', {
|
||||
placeholder: true,
|
||||
placeholderValue: 'I am a placeholder',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<h2>Select one inputs</h2>
|
||||
<div data-test-hook="basic">
|
||||
<label for="choices-basic">Basic</label>
|
||||
<select class="form-control" name="choices-basic" id="choices-basic" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-basic" id="choices-basic">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Find me">Dropdown item 3</option>
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
<div data-test-hook="remove-button">
|
||||
<label for="choices-remove-button">Remove button</label>
|
||||
<select class="form-control" name="choices-remove-button" id="choices-remove-button" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-remove-button" id="choices-remove-button">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
<div data-test-hook="disabled-choice">
|
||||
<label for="choices-disabled-choice">Disabled choice</label>
|
||||
<select class="form-control" name="choices-disabled-choice" id="choices-disabled-choice" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-disabled-choice" id="choices-disabled-choice">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
<div data-test-hook="prepend-append">
|
||||
<label for="choices-prepend-append">Prepend/append</label>
|
||||
<select class="form-control" name="choices-prepend-append" id="choices-prepend-append" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-prepend-append" id="choices-prepend-append">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -70,7 +70,7 @@
|
|||
|
||||
<div data-test-hook="render-choice-limit">
|
||||
<label for="choices-render-choice-limit">Render choice limit</label>
|
||||
<select class="form-control" name="choices-render-choice-limit" id="choices-render-choice-limit" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-render-choice-limit" id="choices-render-choice-limit">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -79,7 +79,7 @@
|
|||
|
||||
<div data-test-hook="search-disabled">
|
||||
<label for="choices-search-disabled">Search disabled</label>
|
||||
<select class="form-control" name="choices-search-disabled" id="choices-search-disabled" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-search-disabled" id="choices-search-disabled">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
@ -88,7 +88,7 @@
|
|||
|
||||
<div data-test-hook="search-floor">
|
||||
<label for="choices-search-floor">Search floor</label>
|
||||
<select class="form-control" name="choices-search-floor" id="choices-search-floor" placeholder="This is a placeholder">
|
||||
<select class="form-control" name="choices-search-floor" id="choices-search-floor">
|
||||
<option value="Dropdown item 1">Dropdown item 1</option>
|
||||
<option value="Dropdown item 2">Dropdown item 2</option>
|
||||
<option value="Dropdown item 3">Dropdown item 3</option>
|
||||
|
|
|
@ -31,47 +31,52 @@
|
|||
<h2>Text inputs</h2>
|
||||
<div data-test-hook="basic">
|
||||
<label for="choices-basic">Basic</label>
|
||||
<input class="form-control" id="choices-basic" type="text" placeholder="Enter something">
|
||||
<input class="form-control" id="choices-basic" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="edit-items">
|
||||
<label for="choices-edit-items">Edit items</label>
|
||||
<input class="form-control" id="choices-edit-items" type="text" placeholder="Enter something">
|
||||
<input class="form-control" id="choices-edit-items" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="remove-button">
|
||||
<label for="choices-remove-button">Remove button</label>
|
||||
<input class="form-control" id="choices-remove-button" type="text" placeholder="Enter something">
|
||||
<input class="form-control" id="choices-remove-button" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="unique-values">
|
||||
<label for="choices-unique-values">Unique values</label>
|
||||
<input class="form-control" id="choices-unique-values" type="text" placeholder="This is a placeholder">
|
||||
<input class="form-control" id="choices-unique-values" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="input-limit">
|
||||
<label for="choices-input-limit">Input limit</label>
|
||||
<input class="form-control" id="choices-input-limit" type="text" placeholder="This is a placeholder">
|
||||
<input class="form-control" id="choices-input-limit" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="regex-filter">
|
||||
<label for="choices-regex-filter">Regex filter</label>
|
||||
<input class="form-control" id="choices-regex-filter" type="text" placeholder="This is a placeholder">
|
||||
<input class="form-control" id="choices-regex-filter" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="disabled">
|
||||
<label for="choices-disabled">Disabled</label>
|
||||
<input class="form-control" id="choices-disabled" type="text" placeholder="This is a placeholder">
|
||||
<input class="form-control" id="choices-disabled" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="prepend-append">
|
||||
<label for="choices-prepend-append">Prepend/append</label>
|
||||
<input class="form-control" id="choices-prepend-append" type="text" placeholder="This is a placeholder">
|
||||
<input class="form-control" id="choices-prepend-append" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="prepopulated">
|
||||
<label for="choices-prepopulated">Pre-populated choices</label>
|
||||
<input class="form-control" id="choices-prepopulated" type="text" placeholder="This is a placeholder">
|
||||
<input class="form-control" id="choices-prepopulated" type="text">
|
||||
</div>
|
||||
|
||||
<div data-test-hook="placeholder">
|
||||
<label for="choices-placeholder">Placeholder</label>
|
||||
<input class="form-control" id="choices-placeholder" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -118,6 +123,11 @@
|
|||
}
|
||||
}],
|
||||
});
|
||||
|
||||
new Choices('#choices-placeholder', {
|
||||
placeholder: true,
|
||||
placeholderValue: 'I am a placeholder',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue