Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = function() {
return Promise.all([
getChannelURL('release'),
getChannelURL('beta'),
getChannelURL('canary')
]).then((urls) => {
return {
useYarn: true,
Expand Down Expand Up @@ -43,14 +42,6 @@ module.exports = function() {
}
}
},
{
name: 'ember-canary',
npm: {
devDependencies: {
'ember-source': urls[2]
}
}
},
// The default `.travis.yml` runs this scenario via `npm test`,
// not via `ember try`. It's still included here so that running
// `ember try:each` manually or from a customized CI config will run it
Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,39 @@
"@ember/render-modifiers": "^1.0.2",
"@glimmer/component": "^1.0.0",
"@glimmer/tracking": "^1.0.0",
"ember-cli-babel": "^7.20.5",
"ember-auto-import": "^1.11.3",
"ember-cli-babel": "^7.26.11",
"ember-cli-htmlbars": "^3.0.0",
"ember-copy": "^1.0.0",
"ember-copy": "^2.0.0",
"ember-list-keyboard-navigator": "^0.1.1",
"ember-truth-helpers": "^2.1.0"
"ember-truth-helpers": "^3.1.1"
},
"devDependencies": {
"@ember/test-helpers": "^2.8.1",
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^2.7.0",
"ember-cli": "~3.20.0",
"ember-cli-chai": "^0.5.0",
"ember-cli-dependency-checker": "^3.0.0",
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-terser": "^4.0.1",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.1.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-mocha": "^0.16.2",
"ember-resolver": "^5.0.1",
"ember-load-initializers": "^2.1.2",
"ember-qunit": "^5.1.5",
"ember-resolver": "^8.0.3",
"ember-source": "~3.28.0",
"ember-source-channel-url": "^3.0.0",
"ember-test-selectors": "^0.3.2",
"ember-try": "^1.0.0",
"ember-test-selectors": "^6.0.0",
"ember-try": "^3.0.0",
"eslint": "^7.1.0",
"eslint-plugin-ember": "^8.6.0",
"eslint-plugin-node": "^11.1.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5"
"npm-run-all": "^4.1.5",
"qunit": "^2.22.0",
"qunit-dom": "^2.0.0"
},
"engines": {
"node": "16.* || >= 18"
Expand Down
7 changes: 7 additions & 0 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@

{{content-for "body-footer"}}
{{content-for "test-body-footer"}}

<div id="qunit"></div>
<div id="qunit-fixture">
<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { assert } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { prepareConfig } from 'ember-search-with-modifiers/utils/search';

describe('Integration | Component | SearchWithModifiers::SearchBox', function() {
setupRenderingTest();
module('Integration | Component | SearchWithModifiers::SearchBox', function(hooks) {
setupRenderingTest(hooks);

const configHash = {
"category:": {
Expand All @@ -21,7 +20,7 @@ describe('Integration | Component | SearchWithModifiers::SearchBox', function()
}
};

it('highlights modifiers', async function() {
test('highlights modifiers', async function(assert) {
this.set('query', '');
this.set('cursorLocation', -1);
this.set('tokenConfig', prepareConfig(configHash));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { assert } from 'chai';
import { it, describe } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, findAll, find, triggerKeyEvent } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

Expand All @@ -12,17 +11,17 @@ const hintList = [
{ category: 'Action Types', index: 1, position: 1, value: 'plant', label: 'plant' },
{ category: 'Action Types', index: 2, position: 2, value: 'mineral', label: 'mineral' } ] } ];

describe('Integration | Component | SearchWithModifiers::SearchModifiers', function() {
setupRenderingTest();
module('Integration | Component | SearchWithModifiers::SearchModifiers', function(hooks) {
setupRenderingTest(hooks);

it('renders', async function() {
test('renders', async function(assert) {
await render(hbs`
<SearchWithModifiers::SearchModifiers />
`);
assert.exists(find('.search-modifiers'));
assert.ok(find('.search-modifiers'));
});

it('displays hintList', async function() {
test('displays hintList', async function(assert) {
this.set('hintList', hintList);

await render(hbs`
Expand All @@ -34,7 +33,7 @@ describe('Integration | Component | SearchWithModifiers::SearchModifiers', funct
['animal', 'plant', 'mineral']);
});

it('list current item works', async function() {
test('list current item works', async function(assert) {
this.set('hintList', hintList);

let model = null;
Expand All @@ -47,7 +46,7 @@ describe('Integration | Component | SearchWithModifiers::SearchModifiers', funct
@hintList={{hintList}}/>
`);

assert.isNull(find('.search-modifier.highlighted'), 'Expected nothing to be selected');
assert.strictEqual(null, find('.search-modifier.highlighted'), 'Expected nothing to be selected');

let target = find('[data-test-list-keyboard-navigator]');
target.focus();
Expand Down
5 changes: 4 additions & 1 deletion tests/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import Application from '../app';
import config from '../config/environment';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-mocha';
import { setup } from 'qunit-dom';
import { start } from 'ember-qunit';

setApplication(Application.create(config.APP));
setup(QUnit.assert);
start();
12 changes: 7 additions & 5 deletions tests/unit/models/token-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { assert } from 'chai';
import { it, describe } from 'mocha';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { prepareConfig } from 'ember-search-with-modifiers/utils/search';
import Token from 'ember-search-with-modifiers/models/token';

describe('Unit | token', function() {
module('Unit | token', function(hooks) {
setupTest(hooks);

const configHash = prepareConfig({
"before:": {
type: 'date',
Expand All @@ -24,7 +26,7 @@ describe('Unit | token', function() {
}
});

it('token list type works', function() {
test('token list type works', function(assert) {
let token = new Token({ configHash, fullText: 'category:plant' });

assert.equal(token.type, 'list');
Expand Down Expand Up @@ -60,7 +62,7 @@ describe('Unit | token', function() {
]);
});

it('token list type works with quoted tokens', function() {
test('token list type works with quoted tokens', function(assert) {
let token = new Token({ configHash, fullText: 'category:"quoted type"' });

assert.equal(token.type, 'list', 'should identify the type');
Expand Down
36 changes: 19 additions & 17 deletions tests/unit/utils/search-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { assert } from 'chai';
import { it, describe } from 'mocha';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { tokenize } from 'ember-search-with-modifiers/utils/search';

describe('Unit | Utility | search', function() {
module('Unit | Utility | search', function(hooks) {
setupTest(hooks);

function tokenizeAndDescribe(text) {
let config = {
'#': {
Expand All @@ -24,56 +26,56 @@ describe('Unit | Utility | search', function() {
}).join('');
}

describe('tokenize', function() {
it('treats words as spaces', function() {
module('tokenize', function() {
test('treats words as spaces', function(assert) {
assert.equal(tokenizeAndDescribe('hello'), 'hello(space)');
});

it('splits words', function() {
test('splits words', function(assert) {
assert.equal(tokenizeAndDescribe('hello world'), 'hello(space) (space)world(space)');
});

it('consolidates spaces', function() {
test('consolidates spaces', function(assert) {
assert.equal(tokenizeAndDescribe('hello world'), 'hello(space) (space)world(space)');
});

it('keeps quoted phrases together', function() {
test('keeps quoted phrases together', function(assert) {
assert.equal(tokenizeAndDescribe('"hello world"'), '"hello world"(space)');
});

it('handles half-quoted phrases', function() {
test('handles half-quoted phrases', function(assert) {
assert.equal(tokenizeAndDescribe('"hello'), '"hello(space)');
});

it('identifies field-modifiers', function() {
test('identifies field-modifiers', function(assert) {
assert.equal(tokenizeAndDescribe('hello fruit:'), 'hello(space) (space)fruit:(field)');
});

it('identifies symbol-modifiers', function() {
test('identifies symbol-modifiers', function(assert) {
assert.equal(tokenizeAndDescribe('#fruits'), '#fruits(symbol)');
});

it('treats completed modifiers as a single token', function() {
test('treats completed modifiers as a single token', function(assert) {
assert.equal(tokenizeAndDescribe('hello fruit:apple'), 'hello(space) (space)fruit:apple(field)');
});

it('permits spaces between a field-modifier and its value', function() {
test('permits spaces between a field-modifier and its value', function(assert) {
assert.equal(tokenizeAndDescribe('hello fruit: apple'), 'hello(space) (space)fruit: apple(field)');
});

it('does not permit spaces between a symbol-modifier and its value', function() {
test('does not permit spaces between a symbol-modifier and its value', function(assert) {
assert.equal(tokenizeAndDescribe('# fruits'), '#(symbol) (space)fruits(space)');
});

it('accepts quoted phrases as values for modifiers', function() {
test('accepts quoted phrases as values for modifiers', function(assert) {
assert.equal(tokenizeAndDescribe('fruit: "apple"'), 'fruit: "apple"(field)');
});

it('treats space after text after modifiers as a token break', function() {
test('treats space after text after modifiers as a token break', function(assert) {
assert.equal(tokenizeAndDescribe('fruit: apple hello'), 'fruit: apple(field) (space)hello(space)');
});

it('treats broken modifiers as a single token', function() {
test('treats broken modifiers as a single token', function(assert) {
assert.equal(tokenizeAndDescribe('hello fruit:grape'), 'hello(space) (space)fruit:grape(field)');
});
});
Expand Down
Loading