├── .editorconfig ├── .ember-cli ├── .eslintignore ├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── ci.yml ├── .gitignore ├── .npmignore ├── .template-lintrc.js ├── .travis.yml ├── .watchmanconfig ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE.md ├── README.md ├── UPGRADE.md ├── addon ├── .gitkeep ├── components │ ├── select-light.hbs │ └── select-light.js └── helpers │ └── is-equal.js ├── app ├── .gitkeep ├── components │ └── select-light.js └── helpers │ └── is-equal.js ├── config ├── ember-try.js └── environment.js ├── ember-cli-build.js ├── index.js ├── package-lock.json ├── package.json ├── tailwind-styled.gif ├── testem.js ├── tests ├── .eslintrc.json ├── dummy │ ├── app │ │ ├── app.js │ │ ├── components │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── index.html │ │ ├── models │ │ │ └── .gitkeep │ │ ├── resolver.js │ │ ├── router.js │ │ ├── routes │ │ │ └── .gitkeep │ │ ├── styles │ │ │ └── app.css │ │ └── templates │ │ │ ├── application.hbs │ │ │ └── components │ │ │ └── .gitkeep │ ├── config │ │ ├── ember-cli-update.json │ │ ├── environment.js │ │ ├── optional-features.json │ │ └── targets.js │ └── public │ │ ├── crossdomain.xml │ │ └── robots.txt ├── helpers │ ├── destroy-app.js │ ├── module-for-acceptance.js │ ├── resolver.js │ └── start-app.js ├── index.html ├── integration │ ├── .gitkeep │ ├── components │ │ └── select-light-test.js │ └── helpers │ │ └── is-equal-test.js ├── test-helper.js └── unit │ └── .gitkeep └── vendor └── .gitkeep /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.hbs] 17 | insert_final_newline = false 18 | 19 | [*.{diff,md}] 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # unconventional js 2 | /blueprints/*/files/ 3 | /vendor/ 4 | 5 | # compiled output 6 | /dist/ 7 | /tmp/ 8 | 9 | # dependencies 10 | /bower_components/ 11 | /node_modules/ 12 | 13 | # misc 14 | /coverage/ 15 | !.* 16 | .eslintcache 17 | 18 | # ember-try 19 | /.node_modules.ember-try/ 20 | /bower.json.ember-try 21 | /package.json.ember-try 22 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | ecmaVersion: 2018, 8 | sourceType: 'module', 9 | ecmaFeatures: { 10 | legacyDecorators: true, 11 | }, 12 | }, 13 | plugins: ['ember'], 14 | extends: [ 15 | 'eslint:recommended', 16 | 'plugin:ember/recommended', 17 | ], 18 | env: { 19 | browser: true, 20 | }, 21 | rules: {}, 22 | overrides: [ 23 | // node files 24 | { 25 | files: [ 26 | '.eslintrc.js', 27 | '.template-lintrc.js', 28 | 'ember-cli-build.js', 29 | 'index.js', 30 | 'testem.js', 31 | 'blueprints/*/index.js', 32 | 'config/**/*.js', 33 | 'tests/dummy/config/**/*.js', 34 | ], 35 | excludedFiles: [ 36 | 'addon/**', 37 | 'addon-test-support/**', 38 | 'app/**', 39 | 'tests/dummy/app/**', 40 | ], 41 | parserOptions: { 42 | sourceType: 'script', 43 | }, 44 | env: { 45 | browser: false, 46 | node: true, 47 | }, 48 | plugins: ['node'], 49 | extends: ['plugin:node/recommended'], 50 | }, 51 | ], 52 | }; 53 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | everything: 7 | name: Checkout, Build, Lint and Test 8 | runs-on: ${{ matrix.os }} 9 | strategy: 10 | matrix: 11 | os: [ubuntu-latest] 12 | node-version: [12.x] 13 | steps: 14 | - name: Check out a copy of the repo 15 | uses: actions/checkout@v2 16 | 17 | - name: Use Node.js ${{ matrix.node-version }} 18 | uses: actions/setup-node@v1 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | 22 | - name: Cache Node.js modules 23 | uses: actions/cache@v2 24 | with: 25 | path: ~/.npm 26 | key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} 27 | restore-keys: | 28 | ${{ runner.OS }}-node- 29 | ${{ runner.OS }}- 30 | 31 | - name: Install dependencies 32 | run: npm install 33 | 34 | - name: Lint Ember addon JS 35 | run: npm run lint:js 36 | 37 | - name: Lint Ember addon HBS 38 | run: npm run lint:hbs 39 | 40 | - name: Test Ember addon 41 | run: npm test 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist/ 5 | /tmp/ 6 | 7 | # dependencies 8 | /bower_components/ 9 | /node_modules/ 10 | 11 | # misc 12 | /.env* 13 | /.pnp* 14 | /.sass-cache 15 | /.eslintcache 16 | /connect.lock 17 | /coverage/ 18 | /libpeerconnection.log 19 | /npm-debug.log* 20 | /testem.log 21 | /yarn-error.log 22 | 23 | # ember-try 24 | /.node_modules.ember-try/ 25 | /bower.json.ember-try 26 | /package.json.ember-try 27 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist/ 3 | /tmp/ 4 | 5 | # dependencies 6 | /bower_components/ 7 | 8 | # misc 9 | /.bowerrc 10 | /.editorconfig 11 | /.ember-cli 12 | /.env* 13 | /.eslintcache 14 | /.eslintignore 15 | /.eslintrc.js 16 | /.gitignore 17 | /.template-lintrc.js 18 | /.travis.yml 19 | /.watchmanconfig 20 | /bower.json 21 | /config/ember-try.js 22 | /ember-cli-build.js 23 | /testem.js 24 | /tests/ 25 | /yarn.lock 26 | .gitkeep 27 | 28 | # ember-try 29 | /.node_modules.ember-try/ 30 | /bower.json.ember-try 31 | /package.json.ember-try 32 | -------------------------------------------------------------------------------- /.template-lintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | extends: 'octane', 5 | }; 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | # we recommend testing addons with the same minimum supported node version as Ember CLI 5 | # so that your addon works for all apps 6 | - "7" 7 | 8 | sudo: false 9 | dist: trusty 10 | 11 | addons: 12 | chrome: stable 13 | 14 | cache: 15 | directories: 16 | - $HOME/.npm 17 | 18 | env: 19 | global: 20 | # See https://git.io/vdao3 for details. 21 | - JOBS=1 22 | 23 | jobs: 24 | fail_fast: true 25 | allow_failures: 26 | - env: EMBER_TRY_SCENARIO=ember-canary 27 | 28 | include: 29 | # runs linting and tests with current locked deps 30 | 31 | - stage: "Tests" 32 | name: "Tests" 33 | script: 34 | - npm run lint:hbs 35 | - npm run lint:js 36 | - npm test 37 | 38 | # we recommend new addons test the current and previous LTS 39 | # as well as latest stable release (bonus points to beta/canary) 40 | - stage: "Additional Tests" 41 | env: EMBER_TRY_SCENARIO=ember-lts-2.16 42 | - env: EMBER_TRY_SCENARIO=ember-lts-2.18 43 | - env: EMBER_TRY_SCENARIO=ember-release 44 | - env: EMBER_TRY_SCENARIO=ember-beta 45 | - env: EMBER_TRY_SCENARIO=ember-canary 46 | - env: EMBER_TRY_SCENARIO=ember-default-with-jquery 47 | 48 | before_install: 49 | - npm config set spin false 50 | - npm install -g npm@4 51 | - npm --version 52 | 53 | script: 54 | - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO 55 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # ember-select-light Changelog 2 | 3 | ### v2.0.4 (December 3, 2020) 4 | - [#26](https://github.com/ember-a11y/ember-select-light/pull/26) [BUGFIX] Fixes use case where passed in options objects have an empty string as the value or label (thanks javve!) 5 | 6 | ### v2.0.3 (November 9, 2020) 7 | - [#27](https://github.com/ember-a11y/ember-select-light/pull/27) [DOCS] Corrected code examples in README, added a tailwind styled example 8 | 9 | ### v2.0.2 (November 9, 2020) 10 | npm publish troubles, no changes 11 | 12 | ### v2.0.1 (October 29, 2020) 13 | Previous two Ember LTS guarenteed to work thanks to ember-try (3.16, 3.20) 14 | - [#17](https://github.com/ember-a11y/ember-select-light/pull/17) [DEVOPS] ember-try added to ensure LTS / future versions work 15 | - [#24](https://github.com/ember-a11y/ember-select-light/pull/24) [DOCS] UPGRADE.md guide for upgrading from v1.x 16 | - [#21](https://github.com/ember-a11y/ember-select-light/pull/21) [DOCS] Better addon description, reference ember-component-patterns 17 | 18 | ### v2.0.0 (October 28, 2020) 19 | - [#20](https://github.com/ember-a11y/ember-select-light/pull/20) [DOCS] Changelog introduced, bumped to 2.x 20 | - [#19](https://github.com/ember-a11y/ember-select-light/pull/19) [DOCS] README Badges 21 | - [#14](https://github.com/ember-a11y/ember-select-light/pull/14) [BREAKING] Ember Octane upgrade, glimmer, dropped Node 6 and 8 22 | - [#12](https://github.com/ember-a11y/ember-select-light/pull/12) [DOCS] Set up GitHub Actions CI 23 | - [#10](https://github.com/ember-a11y/ember-select-light/pull/10) [DOCS] Code of Conduct now matches Ember's 24 | - [#9](https://github.com/ember-a11y/ember-select-light/pull/9) [DOCS] Switched to MIT License 25 | - n/a [BREAKING] Forked from q2ebanking/ember-select-light 26 | 27 | ### v1.3.11 28 | Last version under q2ebanking/ember-select-light umbrella 29 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | This project adheres to the [Ember Community Guidelines](https://emberjs.com/guidelines/). 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | --- 12 | 13 | Originally published under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) (Copyright 2016 Q2 Holdings Inc.) 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ember-Select-Light 2 | 3 | ![CI](https://github.com/ember-a11y/ember-select-light/workflows/CI/badge.svg?branch=main) ![PRs Welcome](https://camo.githubusercontent.com/d4e0f63e9613ee474a7dfdc23c240b9795712c96/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e737667) ![License: MIT](https://camo.githubusercontent.com/890acbdcb87868b382af9a4b1fac507b9659d9bf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![npm package](https://d25lcipzij17d.cloudfront.net/badge.svg?id=js&type=6&v=2.0.0&x2=0)](https://badge.fury.io/js/ember-select-light) [![Ember Observer](https://emberobserver.com/badges/ember-select-light.svg)](https://emberobserver.com/addons/ember-select-light) 4 | 5 | Ember-Select-Light is an Ember Addon focused on simplicity. Just powerful enough to offer expected baseline functionality while being easy to implement, style, and make accessible. 6 | 7 | This addon is [Octane ready](https://emberjs.com/editions/octane/) and follows [ember-component-pattern's for how to best write a Select Element](https://emberjs-1.gitbook.io/ember-component-patterns/form-components/select-element). 8 | 9 | ## Getting Started 10 | 11 | ```bash 12 | ember install ember-select-light 13 | ``` 14 | 15 | ### Example Usage 16 | 17 | ```handlebars 18 | 22 | ``` 23 | 24 | #### With an array of objects... 25 | 26 | ```handlebars 27 | 32 | ``` 33 | 34 | `value` and `label` will be the default object keys used unless `@valueKey="...` and/or `@displayKey="...` are used respectively, like so... 35 | 36 | ```handlebars 37 | 44 | ``` 45 | 46 | #### As a Yield 47 | 48 | ```handlebars 49 | 50 | 51 | 52 | 53 | ``` 54 | 55 | ### Other arguments 56 | 57 | Other arguments are spread onto the `` are handled by a `...attributes`, custom functionality is handled as a passed in property. 25 | 26 | This means that standard attributes such as `disabled`, `id`, `class` can be used like so... 27 | 28 | ```handlebars 29 | 33 | ``` 34 | 35 | Meanwhile, `@placeholder`, `@options`, `@value`, `@placeholder`, `@valueKey`, and `@displayKey` must be prefixed with an `@` to specify properties we're passing to the component (rather than an attribute passed to the select element). 36 | 37 | ```handlebars 38 | 42 | ``` 43 | -------------------------------------------------------------------------------- /addon/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/addon/.gitkeep -------------------------------------------------------------------------------- /addon/components/select-light.hbs: -------------------------------------------------------------------------------- 1 | 30 | -------------------------------------------------------------------------------- /addon/components/select-light.js: -------------------------------------------------------------------------------- 1 | import Component from '@glimmer/component'; 2 | import { isNone } from '@ember/utils'; 3 | import { deprecate } from '@ember/debug'; 4 | 5 | const noop = () => {}; 6 | 7 | export default class extends Component { 8 | constructor() { 9 | super(...arguments); 10 | 11 | this.valueKey = this.args.valueKey ?? 'value'; 12 | this.displayKey = this.args.displayKey ?? 'label'; 13 | this.change = this.args.onChange ?? this.args.change ?? noop; 14 | 15 | deprecate(`Triggering @change on is deprecated in favor of @onChange due to ember-template-lint's no-passed-in-event-handlers rule`, !this.args.change, { 16 | id: 'ember-select-light.no-passed-in-event-handlers', 17 | until: '3.0.0', 18 | for: 'ember-select-light', 19 | since: { 20 | enabled: '2.0.5', 21 | }, 22 | }); 23 | } 24 | 25 | get hasDetailedOptions() { 26 | return ![ // Returns a boolean if all data is available for a { label: foo, value: bar } style list of options 27 | this.args.options?.[0][this.valueKey], 28 | this.args.options?.[0][this.displayKey], 29 | ].some(isNone); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /addon/helpers/is-equal.js: -------------------------------------------------------------------------------- 1 | import { helper } from '@ember/component/helper'; 2 | 3 | export const isEqual = ([left, right]) => left === right; 4 | 5 | export default helper(isEqual); 6 | -------------------------------------------------------------------------------- /app/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/app/.gitkeep -------------------------------------------------------------------------------- /app/components/select-light.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-select-light/components/select-light'; 2 | -------------------------------------------------------------------------------- /app/helpers/is-equal.js: -------------------------------------------------------------------------------- 1 | export { default, isEqual } from 'ember-select-light/helpers/is-equal'; 2 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const getChannelURL = require('ember-source-channel-url'); 4 | 5 | module.exports = async function () { 6 | return { 7 | scenarios: [ 8 | { 9 | name: 'ember-lts-3.16', 10 | npm: { 11 | devDependencies: { 12 | 'ember-source': '~3.16.0', 13 | }, 14 | }, 15 | }, 16 | { 17 | name: 'ember-lts-3.20', 18 | npm: { 19 | devDependencies: { 20 | 'ember-source': '~3.20.5', 21 | }, 22 | }, 23 | }, 24 | { 25 | name: 'ember-release', 26 | npm: { 27 | devDependencies: { 28 | 'ember-source': await getChannelURL('release'), 29 | }, 30 | }, 31 | }, 32 | { 33 | name: 'ember-beta', 34 | npm: { 35 | devDependencies: { 36 | 'ember-source': await getChannelURL('beta'), 37 | }, 38 | }, 39 | }, 40 | { 41 | name: 'ember-canary', 42 | npm: { 43 | devDependencies: { 44 | 'ember-source': await getChannelURL('canary'), 45 | }, 46 | }, 47 | }, 48 | { 49 | name: 'ember-default-with-jquery', 50 | env: { 51 | EMBER_OPTIONAL_FEATURES: JSON.stringify({ 52 | 'jquery-integration': true, 53 | }), 54 | }, 55 | npm: { 56 | devDependencies: { 57 | '@ember/jquery': '^1.1.0', 58 | }, 59 | }, 60 | }, 61 | { 62 | name: 'ember-classic', 63 | env: { 64 | EMBER_OPTIONAL_FEATURES: JSON.stringify({ 65 | 'application-template-wrapper': true, 66 | 'default-async-observers': false, 67 | 'template-only-glimmer-components': false, 68 | }), 69 | }, 70 | npm: { 71 | ember: { 72 | edition: 'classic', 73 | }, 74 | }, 75 | }, 76 | ], 77 | }; 78 | }; 79 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (/* environment, appConfig */) { 4 | return {}; 5 | }; 6 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | module.exports = function (defaults) { 6 | let app = new EmberAddon(defaults, { 7 | // Add options here 8 | }); 9 | 10 | /* 11 | This build file specifies the options for the dummy test app of this 12 | addon, located in `/tests/dummy` 13 | This build file does *not* influence how the addon or the app using it 14 | behave. You most likely want to be modifying `./index.js` or app's build file 15 | */ 16 | 17 | return app.toTree(); 18 | }; 19 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | name: require('./package').name, 5 | }; 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-select-light", 3 | "version": "2.0.5", 4 | "description": "The simple DDAU component built for Ember", 5 | "keywords": [ 6 | "ember-addon" 7 | ], 8 | "repository": "https://github.com/ember-a11y/ember-select-light", 9 | "license": "MIT", 10 | "author": "Ava Wroten (https://www.wroten.me/)", 11 | "directories": { 12 | "doc": "doc", 13 | "test": "tests" 14 | }, 15 | "scripts": { 16 | "build": "ember build --environment=production", 17 | "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix", 18 | "lint:hbs": "ember-template-lint .", 19 | "lint:hbs:fix": "ember-template-lint . --fix", 20 | "lint:js": "eslint . --cache", 21 | "lint:js:fix": "eslint . --fix", 22 | "start": "ember serve", 23 | "test": "npm-run-all lint:* test:*", 24 | "test:ember": "ember test", 25 | "test:ember-compatibility": "ember try:each" 26 | }, 27 | "dependencies": { 28 | "ember-cli-babel": "^7.23.1", 29 | "ember-cli-htmlbars": "^5.3.2" 30 | }, 31 | "devDependencies": { 32 | "@ember/optional-features": "^2.0.0", 33 | "@ember/test-helpers": "^2.2.0", 34 | "@glimmer/component": "^1.0.3", 35 | "@glimmer/tracking": "^1.0.3", 36 | "babel-eslint": "^10.1.0", 37 | "broccoli-asset-rev": "^3.0.0", 38 | "ember-auto-import": "^1.10.1", 39 | "ember-cli": "~3.25.3", 40 | "ember-cli-dependency-checker": "^3.2.0", 41 | "ember-cli-inject-live-reload": "^2.0.2", 42 | "ember-cli-sri": "^2.1.1", 43 | "ember-cli-terser": "^4.0.1", 44 | "ember-disable-prototype-extensions": "^1.1.3", 45 | "ember-export-application-global": "^2.0.1", 46 | "ember-load-initializers": "^2.1.2", 47 | "ember-maybe-import-regenerator": "^0.1.6", 48 | "ember-page-title": "^6.2.1", 49 | "ember-qunit": "^5.1.2", 50 | "ember-resolver": "^8.0.2", 51 | "ember-source": "~3.25.1", 52 | "ember-source-channel-url": "^3.0.0", 53 | "ember-template-lint": "^2.18.1", 54 | "ember-try": "^1.4.0", 55 | "eslint": "^7.20.0", 56 | "eslint-plugin-ember": "^10.2.0", 57 | "eslint-plugin-node": "^11.1.0", 58 | "loader.js": "^4.7.0", 59 | "npm-run-all": "^4.1.5", 60 | "qunit": "^2.14.0", 61 | "qunit-dom": "^1.6.0" 62 | }, 63 | "engines": { 64 | "node": "10.* || >= 12" 65 | }, 66 | "ember": { 67 | "edition": "octane" 68 | }, 69 | "ember-addon": { 70 | "configPath": "tests/dummy/config" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /tailwind-styled.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tailwind-styled.gif -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test_page: 'tests/index.html?hidepassed', 3 | disable_watching: true, 4 | launch_in_ci: ['Chrome'], 5 | launch_in_dev: ['Chrome'], 6 | browser_start_timeout: 120, 7 | browser_args: { 8 | Chrome: { 9 | ci: [ 10 | // --no-sandbox is needed when running Chrome inside a container 11 | process.env.CI ? '--no-sandbox' : null, 12 | '--headless', 13 | '--disable-gpu', 14 | '--disable-dev-shm-usage', 15 | '--disable-software-rasterizer', 16 | '--mute-audio', 17 | '--remote-debugging-port=0', 18 | '--window-size=1440,900', 19 | ].filter(Boolean), 20 | }, 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /tests/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "embertest": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from 'ember-resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from 'dummy/config/environment'; 5 | 6 | export default class App extends Application { 7 | modulePrefix = config.modulePrefix; 8 | podModulePrefix = config.podModulePrefix; 9 | Resolver = Resolver; 10 | } 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/controllers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/helpers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | 12 | 13 | 14 | 15 | 16 | {{content-for "head-footer"}} 17 | 18 | 19 | {{content-for "body"}} 20 | 21 | 22 | 23 | 24 | {{content-for "body-footer"}} 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/models/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | 3 | export default Resolver; 4 | -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from 'dummy/config/environment'; 3 | 4 | export default class Router extends EmberRouter { 5 | location = config.locationType; 6 | rootURL = config.rootURL; 7 | } 8 | 9 | Router.map(function () {}); 10 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/routes/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/styles/app.css -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Tailwind Styled
4 |

5 | Following the Tailwind Custom Select guides. 6 |

7 |
8 |
9 |
10 | 14 |
15 | 16 |
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/dummy/app/templates/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/config/ember-cli-update.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": "1.0.0", 3 | "packages": [ 4 | { 5 | "name": "ember-cli", 6 | "version": "3.25.3", 7 | "blueprints": [ 8 | { 9 | "name": "addon", 10 | "outputRepo": "https://github.com/ember-cli/ember-addon-output", 11 | "codemodsSource": "ember-addon-codemods-manifest@1", 12 | "isBaseBlueprint": true 13 | } 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (environment) { 4 | let ENV = { 5 | modulePrefix: 'dummy', 6 | environment, 7 | rootURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true 13 | }, 14 | EXTEND_PROTOTYPES: { 15 | // Prevent Ember Data from overriding Date.parse. 16 | Date: false, 17 | }, 18 | }, 19 | 20 | APP: { 21 | // Here you can pass flags/options to your application instance 22 | // when it is created 23 | }, 24 | }; 25 | 26 | if (environment === 'development') { 27 | // ENV.APP.LOG_RESOLVER = true; 28 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 29 | // ENV.APP.LOG_TRANSITIONS = true; 30 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 31 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 32 | } 33 | 34 | if (environment === 'test') { 35 | // Testem prefers this... 36 | ENV.locationType = 'none'; 37 | 38 | // keep test console output quieter 39 | ENV.APP.LOG_ACTIVE_GENERATION = false; 40 | ENV.APP.LOG_VIEW_LOOKUPS = false; 41 | 42 | ENV.APP.rootElement = '#ember-testing'; 43 | ENV.APP.autoboot = false; 44 | } 45 | 46 | if (environment === 'production') { 47 | // here you can enable a production-specific feature 48 | } 49 | 50 | return ENV; 51 | }; 52 | -------------------------------------------------------------------------------- /tests/dummy/config/optional-features.json: -------------------------------------------------------------------------------- 1 | { 2 | "application-template-wrapper": false, 3 | "default-async-observers": true, 4 | "jquery-integration": false, 5 | "template-only-glimmer-components": true 6 | } 7 | -------------------------------------------------------------------------------- /tests/dummy/config/targets.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const browsers = [ 4 | 'last 1 Chrome versions', 5 | 'last 1 Firefox versions', 6 | 'last 1 Safari versions', 7 | ]; 8 | 9 | const isCI = Boolean(process.env.CI); 10 | const isProduction = process.env.EMBER_ENV === 'production'; 11 | 12 | if (isCI || isProduction) { 13 | browsers.push('ie 11'); 14 | } 15 | 16 | module.exports = { 17 | browsers, 18 | }; 19 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tests/helpers/destroy-app.js: -------------------------------------------------------------------------------- 1 | import { run } from '@ember/runloop'; 2 | 3 | export default function destroyApp(application) { 4 | run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import startApp from '../helpers/start-app'; 3 | import destroyApp from '../helpers/destroy-app'; 4 | import { resolve } from 'rsvp'; 5 | 6 | export default function(name, options = {}) { 7 | module(name, { 8 | beforeEach() { 9 | this.application = startApp(); 10 | 11 | if (options.beforeEach) { 12 | return options.beforeEach.apply(this, arguments); 13 | } 14 | }, 15 | 16 | afterEach() { 17 | let afterEach = options.afterEach && options.afterEach.apply(this, arguments); 18 | return resolve(afterEach).then(() => destroyApp(this.application)); 19 | } 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from '../../resolver'; 2 | import config from '../../config/environment'; 3 | 4 | const resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Application from '../../app'; 2 | import config from '../../config/environment'; 3 | import { merge } from '@ember/polyfills'; 4 | import { run } from '@ember/runloop'; 5 | 6 | export default function startApp(attrs) { 7 | let attributes = merge({}, config.APP); 8 | attributes = merge(attributes, attrs); // use defaults, but you can override; 9 | 10 | return run(() => { 11 | let application = Application.create(attributes); 12 | application.setupForTesting(); 13 | application.injectTestHelpers(); 14 | return application; 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 |
25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | {{content-for "body-footer"}} 38 | {{content-for "test-body-footer"}} 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/integration/.gitkeep -------------------------------------------------------------------------------- /tests/integration/components/select-light-test.js: -------------------------------------------------------------------------------- 1 | import hbs from 'htmlbars-inline-precompile'; 2 | import { render, fillIn, triggerEvent } from '@ember/test-helpers'; 3 | import { module, test } from 'qunit'; 4 | import { setupRenderingTest } from 'ember-qunit'; 5 | 6 | module('Integration | Component | select-light', function(hooks) { 7 | setupRenderingTest(hooks); 8 | 9 | test('should be a ', async function(assert) { 16 | await render(hbs` 17 | 21 | `); 22 | 23 | assert.dom('select').hasClass('form-item'); 24 | assert.dom('select').hasAttribute('name', 'snail'); 25 | assert.dom('select').hasAttribute('id', 'slug'); 26 | }); 27 | 28 | test('should be able to toggle disabled status', async function(assert) { 29 | this.set('disabled', false); 30 | 31 | await render(hbs``); 32 | 33 | assert.dom('select').doesNotHaveAttribute('disabled'); 34 | 35 | this.set('disabled', true); 36 | assert.dom('select').hasAttribute('disabled'); 37 | }); 38 | 39 | test('should support tabindex', async function(assert) { 40 | this.set('tabindex', null); 41 | 42 | await render(hbs``); 43 | 44 | assert.dom('select').doesNotHaveAttribute('tabindex', '0'); 45 | 46 | this.set('tabindex', 0); 47 | assert.dom('select').hasAttribute('tabindex', '0'); 48 | }); 49 | 50 | test('should have no options if none are specified', async function(assert) { 51 | await render(hbs``); 52 | 53 | assert.dom('select option').doesNotExist(); 54 | }); 55 | 56 | test('should have a (disabled) placeholder option if specified', async function(assert) { 57 | await render(hbs``); 58 | 59 | assert.dom('select option').includesText('Walrus'); 60 | assert.dom('option').hasAttribute('disabled'); 61 | }); 62 | 63 | test('should be able to yield to passed options', async function(assert) { 64 | await render(hbs` 65 | 66 | 67 | 68 | `); 69 | 70 | assert.dom('select option').includesText('Platypus'); 71 | assert.dom('select option').hasValue('plat'); 72 | }); 73 | 74 | test('should render options from passed flat array', async function(assert) { 75 | let options = ['squid', 'octopus']; 76 | this.setProperties({options}); 77 | 78 | await render(hbs``); 79 | 80 | assert.dom('select option').exists({ count: options.length }); 81 | }); 82 | 83 | test('should select option that matches value', async function(assert) { 84 | let options = ['squid', 'octopus']; 85 | let value = options[1]; 86 | this.setProperties({ 87 | options, 88 | value, 89 | }); 90 | 91 | await render(hbs` 92 | 95 | `); 96 | 97 | assert.dom('select').hasValue(value); 98 | }); 99 | 100 | test('should change select value when changing data down value', async function(assert) { 101 | let options = ['shortfin', 'mako']; 102 | let value = options[1]; 103 | this.setProperties({ 104 | options, 105 | value, 106 | }); 107 | 108 | await render(hbs` 109 | 113 | `); 114 | 115 | this.set('value', options[0]); 116 | assert.dom('select').hasValue(options[0]); 117 | }); 118 | 119 | test('should render options correctly when passed array of objects', async function(assert) { 120 | let options = [ 121 | { value: 'shortfin', label: 'Shortfin Shark' }, 122 | { value: 'mako', label: 'Mako Shark' }, 123 | ]; 124 | let value = options[1].value; 125 | this.setProperties({ 126 | options, 127 | value, 128 | }); 129 | 130 | await render(hbs` 131 | `); 134 | 135 | assert.dom('select option').exists({ count: options.length }); 136 | assert.dom('select option').hasAttribute('value', options[0].value); 137 | assert.dom('select option').includesText(options[0].label); 138 | assert.dom('select').hasValue(value); 139 | }); 140 | 141 | test('should render options with customized value and display keys when passed array of objects', async function(assert) { 142 | let options = [ 143 | { val: 'shortfin', description: 'Shortfin Shark' }, 144 | { val: 'mako', description: 'Mako Shark' }, 145 | ]; 146 | let value = options[1].value; 147 | this.setProperties({ 148 | options, 149 | value, 150 | }); 151 | 152 | await render(hbs` 153 | 158 | `); 159 | 160 | assert.dom('select option').hasAttribute('value', options[0].val); 161 | assert.dom('select option').includesText(options[0].description); 162 | }); 163 | 164 | test('should render options correctly when value is an empty string', async function(assert) { 165 | let options = [ 166 | { value: '', label: 'None' }, 167 | { value: 'mako', label: 'Mako Shark' }, 168 | ]; 169 | let value = options[1].value; 170 | this.setProperties({ 171 | options, 172 | value, 173 | }); 174 | 175 | await render(hbs` 176 | `); 179 | 180 | assert.dom('select option').exists({ count: options.length }); 181 | assert.dom('select option').hasAttribute('value', options[0].value); 182 | assert.dom('select option').includesText(options[0].label); 183 | assert.dom('select').hasValue(value); 184 | }); 185 | 186 | test('should fire onChange despite the deprecation warning if using @change', async function(assert) { 187 | this.set('myValue', null); 188 | 189 | await render(hbs` 190 | 191 | 192 | 193 | `); 194 | 195 | await fillIn('select', 'turtle'); 196 | await triggerEvent('select', 'change'); 197 | 198 | assert.dom('select').hasValue('turtle'); 199 | assert.equal(this.myValue, 'turtle'); 200 | }); 201 | 202 | test('should fire onChange when user chooses option, mut with yield', async function(assert) { 203 | this.set('myValue', null); 204 | 205 | await render(hbs` 206 | 207 | 208 | 209 | `); 210 | 211 | await fillIn('select', 'turtle'); 212 | await triggerEvent('select', 'change'); 213 | 214 | assert.dom('select').hasValue('turtle'); 215 | assert.equal(this.myValue, 'turtle'); 216 | }); 217 | 218 | test('should fire onChange when user chooses option, mut with flat array', async function(assert) { 219 | let options = ['clam', 'starfish']; 220 | this.setProperties({ 221 | options, 222 | myValue: options[1], 223 | value: options[1], 224 | }); 225 | 226 | await render(hbs` 227 | 231 | `); 232 | 233 | await fillIn('select', options[0]); 234 | await triggerEvent('select', 'change'); 235 | 236 | assert.dom('select').hasValue(options[0]); 237 | assert.equal(this.myValue, options[0]); 238 | }); 239 | 240 | test('should fire onChange when user chooses option, custom action with flat array', async function(assert) { 241 | let options = ['clam', 'starfish']; 242 | this.setProperties({ 243 | options, 244 | value: options[1], 245 | customAction: ({ target: { value } }) => { 246 | assert.step('handled action'); 247 | assert.equal(value, options[0]); 248 | }, 249 | }); 250 | 251 | await render(hbs` 252 | 256 | `); 257 | await fillIn('select', options[0]); 258 | 259 | assert.verifySteps(['handled action']); 260 | }); 261 | }); 262 | -------------------------------------------------------------------------------- /tests/integration/helpers/is-equal-test.js: -------------------------------------------------------------------------------- 1 | 2 | import hbs from 'htmlbars-inline-precompile'; 3 | import { render } from '@ember/test-helpers'; 4 | import { module, test } from 'qunit'; 5 | import { setupRenderingTest } from 'ember-qunit'; 6 | 7 | module('Integration | Helper | is-equal', function(hooks) { 8 | setupRenderingTest(hooks); 9 | 10 | test('should be true when passed true and true', async function(assert) { 11 | await render(hbs`{{is-equal true true}}`); 12 | 13 | assert.equal(this.element.innerText.trim(), 'true'); 14 | }); 15 | 16 | test('should be false when passed false and true', async function(assert) { 17 | await render(hbs`{{is-equal false true}}`); 18 | 19 | assert.equal(this.element.innerText.trim(), 'false'); 20 | }); 21 | 22 | test('should be false when passed true and false', async function(assert) { 23 | await render(hbs`{{is-equal true false}}`); 24 | 25 | assert.equal(this.element.innerText.trim(), 'false'); 26 | }); 27 | 28 | test('should be true when passed false and false', async function(assert) { 29 | await render(hbs`{{is-equal false false}}`); 30 | 31 | assert.equal(this.element.innerText.trim(), 'true'); 32 | }); 33 | 34 | test('should be true if passed matching strings', async function(assert) { 35 | await render(hbs`{{is-equal 'foo' 'foo'}}`); 36 | 37 | assert.equal(this.element.innerText.trim(), 'true'); 38 | }); 39 | 40 | test('should be false if passed NOT matching strings', async function(assert) { 41 | await render(hbs`{{is-equal 'foo' 'bar'}}`); 42 | 43 | assert.equal(this.element.innerText.trim(), 'false'); 44 | }); 45 | 46 | test('should be true if passed two matching properties', async function(assert) { 47 | this.setProperties({ 48 | left: 'foo', 49 | right: 'foo', 50 | }); 51 | 52 | await render(hbs`{{is-equal left right}}`); 53 | 54 | assert.equal(this.element.innerText.trim(), 'true'); 55 | }); 56 | 57 | test('should be false if passed two NOT matching properties', async function(assert) { 58 | this.setProperties({ 59 | left: 'foo', 60 | right: 'bar', 61 | }); 62 | 63 | await render(hbs`{{is-equal left right}}`); 64 | 65 | assert.equal(this.element.innerText.trim(), 'false'); 66 | }); 67 | 68 | test('should switch as computed properties change', async function(assert) { 69 | this.setProperties({ 70 | left: 'foo', 71 | right: 'bar', 72 | }); 73 | 74 | await render(hbs`{{is-equal left right}}`); 75 | 76 | assert.equal(this.element.innerText.trim(), 'false'); 77 | 78 | this.set('right', 'foo'); 79 | assert.equal(this.element.innerText.trim(), 'true'); 80 | 81 | this.set('left', 'bar'); 82 | assert.equal(this.element.innerText.trim(), 'false'); 83 | }); 84 | 85 | 86 | test('should be true when comparing with the get helper', async function(assert) { 87 | this.setProperties({ 88 | left: 'foo', 89 | right: { deeper: 'foo', }, 90 | }); 91 | 92 | await render(hbs`{{is-equal left (get right 'deeper')}}`); 93 | 94 | assert.equal(this.element.innerText.trim(), 'true'); 95 | }); 96 | 97 | test('should be usable inline to toggle an attribute', async function(assert) { 98 | this.setProperties({ 99 | left: 'foo', 100 | right: 'bar', 101 | }); 102 | 103 | await render(hbs``); 104 | 105 | assert.equal(this.element.children[0].hasAttribute('disabled'), false); 106 | 107 | this.set('right', 'foo'); 108 | assert.equal(this.element.children[0].hasAttribute('disabled'), true); 109 | }); 110 | }); 111 | 112 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import Application from 'dummy/app'; 2 | import config from 'dummy/config/environment'; 3 | import * as QUnit from 'qunit'; 4 | import { setApplication } from '@ember/test-helpers'; 5 | import { setup } from 'qunit-dom'; 6 | import { start } from 'ember-qunit'; 7 | 8 | setApplication(Application.create(config.APP)); 9 | 10 | setup(QUnit.assert); 11 | 12 | start(); 13 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/tests/unit/.gitkeep -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-a11y/ember-select-light/a2bf3a98f6b501d740d1388dbc852a3b267e3846/vendor/.gitkeep --------------------------------------------------------------------------------