mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-06 07:43:12 +02:00
Resolve bug with text value
This commit is contained in:
parent
0f7cbfb6bf
commit
1f06a32b30
|
@ -83,8 +83,6 @@ describe('Choices - text element', () => {
|
|||
cy.get('[data-test-hook=basic]')
|
||||
.find('.choices__input--cloned')
|
||||
.type(`${textInput}`)
|
||||
.type('{enter}')
|
||||
.type(`${textInput}`)
|
||||
.type('{enter}');
|
||||
});
|
||||
|
||||
|
@ -93,7 +91,7 @@ describe('Choices - text element', () => {
|
|||
.find('.choices__list--multiple')
|
||||
.children()
|
||||
.should($items => {
|
||||
expect($items.length).to.equal(2);
|
||||
expect($items.length).to.equal(1);
|
||||
});
|
||||
|
||||
cy.get('[data-test-hook=basic]')
|
||||
|
@ -104,10 +102,24 @@ describe('Choices - text element', () => {
|
|||
.click();
|
||||
|
||||
cy.get('[data-test-hook=basic]')
|
||||
.find('.choices__list--multiple')
|
||||
.first()
|
||||
.find('.choices__list--multiple .choices__item')
|
||||
.should($items => {
|
||||
expect($items.length).to.equal(1);
|
||||
expect($items.length).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('updates the value of the original input', () => {
|
||||
cy.get('[data-test-hook=basic]')
|
||||
.find('.choices__list--multiple .choices__item')
|
||||
.last()
|
||||
.find('.choices__button')
|
||||
.focus()
|
||||
.click();
|
||||
|
||||
cy.get('[data-test-hook=basic]')
|
||||
.find('.choices__input.is-hidden')
|
||||
.then($input => {
|
||||
expect($input.val()).to.not.contain(textInput);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,13 +23,6 @@
|
|||
<link rel="stylesheet" href="../assets/styles/choices.min.css?version=3.0.2">
|
||||
<script src="../assets/scripts/choices.min.js?version=2.8.8"></script>
|
||||
<!-- End Choices includes -->
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<style>
|
||||
.hidden-ie { display: none; }
|
||||
.visible-ie { display: block; }
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -577,15 +577,13 @@ class Choices {
|
|||
const activeItems = this._store.activeItems || [];
|
||||
this.itemList.clear();
|
||||
|
||||
if (activeItems.length) {
|
||||
// Create a fragment to store our list items
|
||||
// (so we don't have to update the DOM for each item)
|
||||
const itemListFragment = this._createItemsFragment(activeItems);
|
||||
// Create a fragment to store our list items
|
||||
// (so we don't have to update the DOM for each item)
|
||||
const itemListFragment = this._createItemsFragment(activeItems);
|
||||
|
||||
// If we have items to add, append them
|
||||
if (itemListFragment.childNodes) {
|
||||
this.itemList.append(itemListFragment);
|
||||
}
|
||||
// If we have items to add, append them
|
||||
if (itemListFragment.childNodes) {
|
||||
this.itemList.append(itemListFragment);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue