mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-20 14:36:34 +02:00
Tests corrections.
This commit is contained in:
parent
ef661f4615
commit
4627bb3201
|
@ -5,8 +5,8 @@
|
||||||
"main": "./assets/scripts/dist/choices.min.js",
|
"main": "./assets/scripts/dist/choices.min.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server.js",
|
"start": "node server.js",
|
||||||
"test": "./node_modules/karma/bin/karma start --single-run --no-auto-watch tests/karma.config.js",
|
"test": "karma start --single-run --no-auto-watch tests/karma.config.js",
|
||||||
"test:watch": "./node_modules/karma/bin/karma start --auto-watch --no-single-run tests/karma.config.js",
|
"test:watch": "karma start --auto-watch --no-single-run tests/karma.config.js",
|
||||||
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
|
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
|
||||||
"css:build": "npm run css:sass -s && npm run css:prefix -s && npm run css:min -s",
|
"css:build": "npm run css:sass -s && npm run css:prefix -s && npm run css:min -s",
|
||||||
"css:sass": "node-sass --output-style expanded --include-path scss assets/styles/scss/base.scss assets/styles/css/base.css && node-sass --output-style expanded --include-path scss assets/styles/scss/choices.scss assets/styles/css/choices.css",
|
"css:sass": "node-sass --output-style expanded --include-path scss assets/styles/scss/base.scss assets/styles/css/base.css && node-sass --output-style expanded --include-path scss assets/styles/scss/choices.scss assets/styles/css/choices.css",
|
||||||
|
|
|
@ -36,7 +36,7 @@ describe('Choices', () => {
|
||||||
const reinitialise = new Choices(this.choices.passedElement);
|
const reinitialise = new Choices(this.choices.passedElement);
|
||||||
spyOn(reinitialise, '_createTemplates');
|
spyOn(reinitialise, '_createTemplates');
|
||||||
expect(reinitialise._createTemplates).not.toHaveBeenCalled();
|
expect(reinitialise._createTemplates).not.toHaveBeenCalled();
|
||||||
})
|
});
|
||||||
|
|
||||||
it('should have a blank state', function() {
|
it('should have a blank state', function() {
|
||||||
expect(this.choices.currentState.items.length).toEqual(0);
|
expect(this.choices.currentState.items.length).toEqual(0);
|
||||||
|
@ -263,7 +263,7 @@ describe('Choices', () => {
|
||||||
this.choices.destroy();
|
this.choices.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the choice list on focussing', function() {
|
it('should open the choice list on focusing', function() {
|
||||||
this.choices = new Choices(this.input);
|
this.choices = new Choices(this.input);
|
||||||
this.choices.input.focus();
|
this.choices.input.focus();
|
||||||
expect(this.choices.dropdown.classList).toContain(this.choices.config.classNames.activeState);
|
expect(this.choices.dropdown.classList).toContain(this.choices.config.classNames.activeState);
|
||||||
|
@ -278,7 +278,7 @@ describe('Choices', () => {
|
||||||
this.choices = new Choices(this.input);
|
this.choices = new Choices(this.input);
|
||||||
this.choices.input.focus();
|
this.choices.input.focus();
|
||||||
|
|
||||||
for (var i = 0; i < 2; i++) {
|
for (let i = 0; i < 2; i++) {
|
||||||
// Key down to third choice
|
// Key down to third choice
|
||||||
this.choices._onKeyDown({
|
this.choices._onKeyDown({
|
||||||
target: this.choices.input,
|
target: this.choices.input,
|
||||||
|
@ -500,7 +500,7 @@ describe('Choices', () => {
|
||||||
expect(this.choices.currentState.choices[0].value).toEqual('Value 5');
|
expect(this.choices.currentState.choices[0].value).toEqual('Value 5');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should sort choices if shouldSort is false', function() {
|
it('should sort choices if shouldSort is true', function() {
|
||||||
this.choices = new Choices(this.input, {
|
this.choices = new Choices(this.input, {
|
||||||
shouldSort: true,
|
shouldSort: true,
|
||||||
choices: [{
|
choices: [{
|
||||||
|
@ -942,7 +942,7 @@ describe('Choices', () => {
|
||||||
customProperties: {
|
customProperties: {
|
||||||
foo: 'bar'
|
foo: 'bar'
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const expectedState = [{
|
const expectedState = [{
|
||||||
id: randomItem.id,
|
id: randomItem.id,
|
||||||
|
@ -978,7 +978,7 @@ describe('Choices', () => {
|
||||||
customProperties: {
|
customProperties: {
|
||||||
foo: 'bar'
|
foo: 'bar'
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const expectedState = [{
|
const expectedState = [{
|
||||||
id: randomChoice.id,
|
id: randomChoice.id,
|
||||||
|
|
Loading…
Reference in a new issue