├── .bowerrc ├── .editorconfig ├── .ember-cli ├── .gitignore ├── .jshintrc ├── .npmignore ├── .travis.yml ├── .watchmanconfig ├── LICENSE.md ├── README.md ├── addon ├── .gitkeep ├── components │ └── power-select-with-fallback.js ├── controllers │ └── application.js ├── templates │ └── components │ │ └── power-select-with-fallback.hbs └── utils │ ├── is-android.js │ ├── is-ios.js │ ├── is-mobile.js │ └── is-windows-phone.js ├── app ├── .gitkeep ├── components │ └── power-select-with-fallback.js └── controllers │ └── application.js ├── bower.json ├── config ├── deploy.js ├── ember-try.js └── environment.js ├── ember-cli-build.js ├── index.js ├── package.json ├── testem.js ├── tests ├── .jshintrc ├── 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 │ │ └── environment.js │ └── public │ │ ├── crossdomain.xml │ │ └── robots.txt ├── helpers │ ├── destroy-app.js │ ├── module-for-acceptance.js │ ├── resolver.js │ └── start-app.js ├── index.html ├── integration │ └── .gitkeep ├── test-helper.js └── unit │ ├── .gitkeep │ └── controllers │ └── application-test.js └── vendor └── .gitkeep /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log* 17 | testem.log 18 | 19 | .env.deploy.* 20 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "-Promise" 6 | ], 7 | "browser": true, 8 | "boss": true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esversion": 6, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /bower_components 2 | /config/ember-try.js 3 | /dist 4 | /tests 5 | /tmp 6 | **/.gitkeep 7 | .bowerrc 8 | .editorconfig 9 | .ember-cli 10 | .gitignore 11 | .jshintrc 12 | .watchmanconfig 13 | .travis.yml 14 | bower.json 15 | ember-cli-build.js 16 | testem.js 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "4" 5 | 6 | sudo: false 7 | 8 | cache: 9 | directories: 10 | - $HOME/.npm 11 | - $HOME/.cache # includes bowers cache 12 | 13 | env: 14 | # we recommend testing LTS's and latest stable release (bonus points to beta/canary) 15 | - EMBER_TRY_SCENARIO=ember-lts-2.4 16 | - EMBER_TRY_SCENARIO=ember-lts-2.8 17 | - EMBER_TRY_SCENARIO=ember-release 18 | - EMBER_TRY_SCENARIO=ember-beta 19 | - EMBER_TRY_SCENARIO=ember-canary 20 | 21 | matrix: 22 | fast_finish: true 23 | allow_failures: 24 | - env: EMBER_TRY_SCENARIO=ember-canary 25 | 26 | before_install: 27 | - npm config set spin false 28 | - npm install -g bower 29 | - bower --version 30 | - npm install phantomjs-prebuilt 31 | - node_modules/phantomjs-prebuilt/bin/phantomjs --version 32 | 33 | install: 34 | - npm install 35 | - bower install 36 | 37 | script: 38 | # Usually, it's ok to finish the test scenario without reverting 39 | # to the addon's original dependency state, skipping "cleanup". 40 | - ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup 41 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ember-power-select-with-fallback 2 | 3 | This is a addon on top Ember Power Select that based on some criteria decides if renders the rich `{{#power-select}}` 4 | component or fallbacks to a simpler ` 3 | 4 | {{#if labelPath}} 5 | 6 | {{#each options as |opt index|}} 7 | {{#if opt.groupName}} 8 | 9 | {{#each opt.options as |suboption subindex|}} 10 | 11 | {{/each}} 12 | 13 | {{else}} 14 | 15 | {{/if}} 16 | {{/each}} 17 | 18 | {{else}} 19 | 20 | {{#each options as |opt index|}} 21 | {{#if opt.groupName}} 22 | 23 | {{#each opt.options as |suboption subindex|}} 24 | 25 | {{/each}} 26 | 27 | {{else}} 28 | 29 | {{/if}} 30 | {{/each}} 31 | 32 | {{/if}} 33 | 34 | {{else if (hasBlock "inverse")}} 35 | {{#power-select 36 | options=options 37 | selected=selected 38 | onchange=onchange 39 | onkeydown=onkeydown 40 | onfocus=onfocus 41 | onopen=onopen 42 | onclose=onclose 43 | disabled=disabled 44 | placeholder=placeholder 45 | searchEnabled=searchEnabled 46 | searchPlaceholder=searchPlaceholder 47 | loadingMessage=loadingMessage 48 | noMatchesMessage=noMatchesMessage 49 | searchMessage=searchMessage 50 | triggerComponent=triggerComponent 51 | selectedItemComponent=selectedItemComponent 52 | beforeOptionsComponent=beforeOptionsComponent 53 | optionsComponent=optionsComponent 54 | afterOptionsComponent=afterOptionsComponent 55 | matcher=matcher 56 | matchTriggerWidth=matchTriggerWidth 57 | searchField=searchField 58 | renderInPlace=renderInPlace 59 | destination=destination 60 | search=search 61 | allowClear=allowClear 62 | verticalPosition=verticalPosition 63 | horizontalPosition=horizontalPosition 64 | closeOnSelect=closeOnSelect 65 | opened=opened 66 | tabindex=tabindex 67 | dir=dir 68 | class=class 69 | triggerClass=triggerClass 70 | dropdownClass=dropdownClass 71 | extra=extra 72 | triggerId=triggerId 73 | as |option term|}} 74 | {{yield option term}} 75 | {{else}} 76 | {{yield to="inverse"}} 77 | {{/power-select}} 78 | {{else}} 79 | {{#power-select 80 | options=options 81 | selected=selected 82 | onchange=onchange 83 | onkeydown=onkeydown 84 | onfocus=onfocus 85 | onopen=onopen 86 | onclose=onclose 87 | disabled=disabled 88 | placeholder=placeholder 89 | searchEnabled=searchEnabled 90 | searchPlaceholder=searchPlaceholder 91 | loadingMessage=loadingMessage 92 | noMatchesMessage=noMatchesMessage 93 | searchMessage=searchMessage 94 | triggerComponent=triggerComponent 95 | selectedItemComponent=selectedItemComponent 96 | beforeOptionsComponent=beforeOptionsComponent 97 | optionsComponent=optionsComponent 98 | afterOptionsComponent=afterOptionsComponent 99 | matcher=matcher 100 | matchTriggerWidth=matchTriggerWidth 101 | searchField=searchField 102 | renderInPlace=renderInPlace 103 | destination=destination 104 | search=search 105 | allowClear=allowClear 106 | verticalPosition=verticalPosition 107 | horizontalPosition=horizontalPosition 108 | closeOnSelect=closeOnSelect 109 | opened=opened 110 | tabindex=tabindex 111 | dir=dir 112 | class=class 113 | triggerClass=triggerClass 114 | dropdownClass=dropdownClass 115 | extra=extra 116 | triggerId=triggerId 117 | as |option term|}} 118 | {{yield option term}} 119 | {{/power-select}} 120 | {{/if}} 121 | -------------------------------------------------------------------------------- /addon/utils/is-android.js: -------------------------------------------------------------------------------- 1 | export default function isAndroid() { 2 | return window.navigator.userAgent.toLowerCase().indexOf("android") > -1; 3 | } 4 | -------------------------------------------------------------------------------- /addon/utils/is-ios.js: -------------------------------------------------------------------------------- 1 | export default function isIos() { 2 | return /iPad|iPhone|iPod/.test(window.navigator.userAgent) && !window.MSStream; 3 | } 4 | -------------------------------------------------------------------------------- /addon/utils/is-mobile.js: -------------------------------------------------------------------------------- 1 | import isIos from './is-ios'; 2 | import isAndroid from './is-android'; 3 | import isWindowsPhone from './is-windows-phone'; 4 | 5 | export default function isMobile() { 6 | return isIos() || isAndroid() || isWindowsPhone(); 7 | } 8 | -------------------------------------------------------------------------------- /addon/utils/is-windows-phone.js: -------------------------------------------------------------------------------- 1 | export default function isWindowsPhone() { 2 | return window.navigator.userAgent.match(/Windows Phone/i); 3 | } 4 | -------------------------------------------------------------------------------- /app/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/app/.gitkeep -------------------------------------------------------------------------------- /app/components/power-select-with-fallback.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-power-select-with-fallback/components/power-select-with-fallback'; -------------------------------------------------------------------------------- /app/controllers/application.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-power-select-with-fallback/controllers/application'; 2 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-power-select-with-fallback", 3 | "dependencies": { 4 | "ember": "~2.10.0", 5 | "ember-cli-shims": "0.1.3" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /config/deploy.js: -------------------------------------------------------------------------------- 1 | module.exports = function(deployTarget) { 2 | return { 3 | pagefront: { 4 | app: 'ember-power-select-with-fallback', 5 | key: process.env.PAGEFRONT_KEY 6 | } 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | scenarios: [ 4 | { 5 | name: 'ember-lts-2.4', 6 | bower: { 7 | dependencies: { 8 | 'ember': 'components/ember#lts-2-4' 9 | }, 10 | resolutions: { 11 | 'ember': 'lts-2-4' 12 | } 13 | } 14 | }, 15 | { 16 | name: 'ember-lts-2.8', 17 | bower: { 18 | dependencies: { 19 | 'ember': 'components/ember#lts-2-8' 20 | }, 21 | resolutions: { 22 | 'ember': 'lts-2-8' 23 | } 24 | } 25 | }, 26 | { 27 | name: 'ember-release', 28 | bower: { 29 | dependencies: { 30 | 'ember': 'components/ember#release' 31 | }, 32 | resolutions: { 33 | 'ember': 'release' 34 | } 35 | } 36 | }, 37 | { 38 | name: 'ember-beta', 39 | bower: { 40 | dependencies: { 41 | 'ember': 'components/ember#beta' 42 | }, 43 | resolutions: { 44 | 'ember': 'beta' 45 | } 46 | } 47 | }, 48 | { 49 | name: 'ember-canary', 50 | bower: { 51 | dependencies: { 52 | 'ember': 'components/ember#canary' 53 | }, 54 | resolutions: { 55 | 'ember': 'canary' 56 | } 57 | } 58 | } 59 | ] 60 | }; 61 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | 'use strict'; 3 | 4 | module.exports = function(/* environment, appConfig */) { 5 | return { }; 6 | }; 7 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | /* global require, module */ 3 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | module.exports = function(defaults) { 6 | var 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 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | module.exports = { 5 | name: 'ember-power-select-with-fallback', 6 | 7 | contentFor: function(type, config) { 8 | var emberPowerSelect = this.addons.filter(function(addon) { 9 | return addon.name === 'ember-power-select'; 10 | })[0] 11 | return emberPowerSelect.contentFor(type, config); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-power-select-with-fallback", 3 | "version": "0.3.0", 4 | "description": "The default blueprint for ember-cli addons.", 5 | "directories": { 6 | "doc": "doc", 7 | "test": "tests" 8 | }, 9 | "scripts": { 10 | "build": "ember build", 11 | "start": "ember server", 12 | "test": "ember try:each" 13 | }, 14 | "repository": "https://github.com/cibernox/ember-power-select-with-fallback", 15 | "engines": { 16 | "node": ">= 0.12.0" 17 | }, 18 | "author": "Miguel Camba", 19 | "license": "MIT", 20 | "devDependencies": { 21 | "broccoli-asset-rev": "^2.4.5", 22 | "ember-ajax": "^2.4.1", 23 | "ember-cli": "~3.4.1", 24 | "ember-cli-app-version": "^2.0.0", 25 | "ember-cli-dependency-checker": "^1.3.0", 26 | "ember-cli-deploy": "0.5.1", 27 | "ember-cli-htmlbars-inline-precompile": "^0.3.3", 28 | "ember-cli-inject-live-reload": "^1.4.1", 29 | "ember-cli-jshint": "^2.0.1", 30 | "ember-cli-qunit": "^3.0.1", 31 | "ember-cli-release": "^0.2.9", 32 | "ember-cli-sri": "^2.1.0", 33 | "ember-cli-test-loader": "^1.1.0", 34 | "ember-cli-uglify": "^1.2.0", 35 | "ember-data": "^2.10.0", 36 | "ember-disable-prototype-extensions": "^1.1.0", 37 | "ember-export-application-global": "^1.0.5", 38 | "ember-load-initializers": "^0.5.1", 39 | "ember-pagefront": "0.10.10", 40 | "ember-resolver": "^2.0.3", 41 | "loader.js": "^4.0.10" 42 | }, 43 | "keywords": [ 44 | "ember-addon", 45 | "ember-power-select-addon", 46 | "select", 47 | "fallback", 48 | "native", 49 | "mobile" 50 | ], 51 | "dependencies": { 52 | "ember-cli-babel": "^6.16.0", 53 | "ember-cli-htmlbars": "^3.0.0", 54 | "ember-power-select": "^1.0.0" 55 | }, 56 | "ember-addon": { 57 | "configPath": "tests/dummy/config" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | "framework": "qunit", 4 | "test_page": "tests/index.html?hidepassed", 5 | "disable_watching": true, 6 | "launch_in_ci": [ 7 | "PhantomJS" 8 | ], 9 | "launch_in_dev": [ 10 | "PhantomJS", 11 | "Chrome" 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "define", 10 | "console", 11 | "visit", 12 | "exists", 13 | "fillIn", 14 | "click", 15 | "keyEvent", 16 | "triggerEvent", 17 | "find", 18 | "findWithAssert", 19 | "wait", 20 | "DS", 21 | "andThen", 22 | "currentURL", 23 | "currentPath", 24 | "currentRouteName" 25 | ], 26 | "node": false, 27 | "browser": false, 28 | "boss": true, 29 | "curly": true, 30 | "debug": false, 31 | "devel": false, 32 | "eqeqeq": true, 33 | "evil": true, 34 | "forin": false, 35 | "immed": false, 36 | "laxbreak": false, 37 | "newcap": true, 38 | "noarg": true, 39 | "noempty": false, 40 | "nonew": false, 41 | "nomen": false, 42 | "onevar": false, 43 | "plusplus": false, 44 | "regexp": false, 45 | "undef": true, 46 | "sub": true, 47 | "strict": false, 48 | "white": false, 49 | "eqnull": true, 50 | "esversion": 6, 51 | "unused": true 52 | } 53 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from './resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | let App; 7 | 8 | Ember.MODEL_FACTORY_INJECTIONS = true; 9 | 10 | App = Ember.Application.extend({ 11 | modulePrefix: config.modulePrefix, 12 | podModulePrefix: config.podModulePrefix, 13 | Resolver 14 | }); 15 | 16 | loadInitializers(App, config.modulePrefix); 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/dummy/app/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/dummy/app/controllers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/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 | {{content-for "head-footer"}} 16 | 17 | 18 | {{content-for "body"}} 19 | 20 | 21 | 22 | 23 | {{content-for "body-footer"}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/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 Ember from 'ember'; 2 | import config from './config/environment'; 3 | 4 | const Router = Ember.Router.extend({ 5 | location: config.locationType, 6 | rootURL: config.rootURL 7 | }); 8 | 9 | Router.map(function() { 10 | }); 11 | 12 | export default Router; 13 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/dummy/app/routes/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/dummy/app/styles/app.css -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |

Welcome to Ember

2 | 3 | 4 | 5 |

Options are strings

6 | {{#power-select-with-fallback options=numbers mustFallback=mustFallback selected=number onchange=(action (mut number)) as |num|}} 7 | {{num}} 8 | {{/power-select-with-fallback}} 9 | 10 |

Options are objects

11 | 12 | {{#power-select-with-fallback options=users mustFallback=mustFallback selected=user onchange=(action (mut user)) labelPath="name" as |user|}} 13 | {{user.name}} 14 | {{/power-select-with-fallback}} 15 | 16 |

Grouped options (does not support more than 1 level of nesting)

17 | 18 | {{#power-select-with-fallback options=nestedNumbers mustFallback=mustFallback selected=otherNum onchange=(action (mut otherNum)) as |num|}} 19 | {{num}} 20 | {{/power-select-with-fallback}} 21 | 22 | 23 |

Supports a placeholder

24 | 25 | {{#power-select-with-fallback options=numbers mustFallback=mustFallback selected=evenAnotherNum onchange=(action (mut evenAnotherNum)) placeholder="Please, choose one..." as |num|}} 26 | {{num}} 27 | {{/power-select-with-fallback}} 28 | 29 |

Fallback automatically in mobile (ignores the button)

30 |

Visit this page in mobile and you will see a native select, visit it in desktop you will see the power-select component

31 | 32 | {{#power-select-with-fallback options=users fallback-when='mobile' selected=otherUser onchange=(action (mut otherUser)) labelPath="name" as |user|}} 33 | {{user.name}} 34 | {{/power-select-with-fallback}} -------------------------------------------------------------------------------- /tests/dummy/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/dummy/app/templates/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 3 | module.exports = function(environment) { 4 | var ENV = { 5 | modulePrefix: 'dummy', 6 | environment: 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. 'with-controller': 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 | } 44 | 45 | if (environment === 'production') { 46 | 47 | } 48 | 49 | return ENV; 50 | }; 51 | -------------------------------------------------------------------------------- /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 Ember from 'ember'; 2 | 3 | export default function destroyApp(application) { 4 | Ember.run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import Ember from 'ember'; 3 | import startApp from '../helpers/start-app'; 4 | import destroyApp from '../helpers/destroy-app'; 5 | 6 | const { RSVP: { Promise } } = Ember; 7 | 8 | export default function(name, options = {}) { 9 | module(name, { 10 | beforeEach() { 11 | this.application = startApp(); 12 | 13 | if (options.beforeEach) { 14 | return options.beforeEach.apply(this, arguments); 15 | } 16 | }, 17 | 18 | afterEach() { 19 | let afterEach = options.afterEach && options.afterEach.apply(this, arguments); 20 | return Promise.resolve(afterEach).then(() => destroyApp(this.application)); 21 | } 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /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 Ember from 'ember'; 2 | import Application from '../../app'; 3 | import config from '../../config/environment'; 4 | 5 | export default function startApp(attrs) { 6 | let application; 7 | 8 | let attributes = Ember.merge({}, config.APP); 9 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 10 | 11 | Ember.run(() => { 12 | application = Application.create(attributes); 13 | application.setupForTesting(); 14 | application.injectTestHelpers(); 15 | }); 16 | 17 | return application; 18 | } 19 | -------------------------------------------------------------------------------- /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 | {{content-for "body-footer"}} 31 | {{content-for "test-body-footer"}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/integration/.gitkeep -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | 6 | setResolver(resolver); 7 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/tests/unit/.gitkeep -------------------------------------------------------------------------------- /tests/unit/controllers/application-test.js: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit'; 2 | 3 | moduleFor('controller:application', 'Unit | Controller | application', { 4 | // Specify the other units that are required for this test. 5 | // needs: ['controller:foo'] 6 | }); 7 | 8 | // Replace this with your real tests. 9 | test('it exists', function(assert) { 10 | let controller = this.subject(); 11 | assert.ok(controller); 12 | }); 13 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cibernox/ember-power-select-with-fallback/ab89c05b54cb293f860f2793d80f332aba43d8d1/vendor/.gitkeep --------------------------------------------------------------------------------