Skip to content

Commit

Permalink
Merge branch 'master' into upgrading-to-ember3
Browse files Browse the repository at this point in the history
# Conflicts:
#	.circleci/config.yml
#	.gitignore
#	README.md
#	addon/mixins/ctrl-enter-submits-form.js
#	addon/mixins/enter-submits-form.js
#	addon/mixins/escape-key-clears.js
#	addon/mixins/focus-selects-text.js
#	addon/mixins/trigger-focus.js
#	config/ember-try.js
#	install_ember_addons.sh
#	package.json
#	tests/dummy/app/index.html
#	tests/integration/components/input-text-test.js
#	yarn.lock
  • Loading branch information
nadnoslen committed Nov 8, 2018
2 parents 4b59c5b + 84fdf44 commit 3abf269
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 124 deletions.
50 changes: 23 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
test_default:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -59,6 +61,8 @@ jobs:
test_release:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -75,6 +79,8 @@ jobs:
test_beta:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -91,6 +97,8 @@ jobs:
test_canary:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -107,6 +115,8 @@ jobs:
test_lts_2_4:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -123,6 +133,8 @@ jobs:
test_lts_2_8:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -139,6 +151,8 @@ jobs:
test_lts_2_12:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -155,6 +169,8 @@ jobs:
test_lts_2_16:
docker:
- image: circleci/node:6.14.4-browsers
environment:
COVERAGE: true
steps:
- checkout
- restore_cache:
Expand All @@ -168,22 +184,6 @@ jobs:
- run:
name: Ember Try
command: ./node_modules/.bin/ember try:one ember-lts-2.16 --skip-cleanup
test_lts_2_18:
docker:
- image: circleci/node:6.14.4-browsers
steps:
- checkout
- restore_cache:
keys:
- bower-cache-{{ .Branch }}-{{ checksum "bower.json" }}
- restore_cache:
keys:
- v1-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-deps-{{ .Branch }}-
- v1-deps-
- run:
name: Ember Try
command: ./node_modules/.bin/ember try:one ember-lts-2.18 --skip-cleanup
workflows:
version: 2
ember_try:
Expand All @@ -206,23 +206,19 @@ workflows:
requires:
- bower_and_cache
- yarn_and_cache
- test_lts_2_18:
- test_lts_2_16:
requires:
- bower_and_cache
- yarn_and_cache
- test_lts_2_16:
- test_lts_2_12:
requires:
- bower_and_cache
- yarn_and_cache
- test_lts_2_12:
- test_lts_2_8:
requires:
- bower_and_cache
- yarn_and_cache
- test_lts_2_4:
requires:
- bower_and_cache
- yarn_and_cache
# - test_lts_2_8:
# requires:
# - bower_and_cache
# - yarn_and_cache
# - test_lts_2_4:
# requires:
# - bower_and_cache
# - yarn_and_cache
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ testem.log
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try

/.gtm/
108 changes: 51 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,59 @@

Ember.TextSupport enhancements including a `{{input-text}}` and `{{text-area}}` component.

## Requirements
## Built With

* Ember >= 1.13.0
* Ember CLI
[![ember-cli-2.18.2](https://img.shields.io/badge/ember--cli-2.18.2-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)

## Installation
## Tested Against

### Ember-2.9 and later
[![ember-lts-2.4](https://img.shields.io/badge/ember--try-ember--lts--2.4-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-lts-2.8](https://img.shields.io/badge/ember--try-ember--lts--2.8-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-lts-2.12](https://img.shields.io/badge/ember--try-ember--lts--2.12-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-lts-2.16](https://img.shields.io/badge/ember--try-ember--lts--2.16-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)

```
ember install ember-cli-text-support-mixins
```
[![ember-release-2.18](https://img.shields.io/badge/ember--try-ember--release--2.18-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-default](https://img.shields.io/badge/ember--try-ember--default-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-beta](https://img.shields.io/badge/ember--try-ember--beta-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-canary](https://img.shields.io/badge/ember--try-ember--canary-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)

### Ember-1.13 -> Ember-2.8
## Installation

The following command will install this add-on:

```
ember install ember-cli-text-support-mixins@1.1.2
ember install ember-cli-text-support-mixins
```

### Upgrading

When working through the Ember upgrade process, I recommend
invoking the `ember install ember-cli-text-support-mixins` command once
you are done to get the latest version of the addon.
you are done to get the latest version of the add-on.

## Tested Against
This will likely update the dependencies listed above.

[![ember-lts-2.12](https://img.shields.io/badge/ember--try-ember--lts--2.12-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-lts-2.16](https://img.shields.io/badge/ember--try-ember--lts--2.16-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-lts-2.18](https://img.shields.io/badge/ember--try-ember--lts--2.18-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
### Bower & JQuery

[![ember-release](https://img.shields.io/badge/ember--try-ember--release-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-beta](https://img.shields.io/badge/ember--try-ember--beta-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
[![ember-canary](https://img.shields.io/badge/ember--try-ember--canary-brightgreen.svg)](https://circleci.com/gh/cybertoothca/ember-cli-text-support-mixins)
This add-on does not depend on bower libraries when installed in your application or add-on.

This add-on no longer depends on JQuery.

### Dependencies

#### `keyevent`

The constants from [`keyevent`](https://github.com/cybertoothca/keyevent) are installed
by yarn and `ember-cli-node-assets`.

## Demo

The demonstration web application can be found here:
[http://ember-cli-text-support-mixins.cybertooth.io/](http://ember-cli-text-support-mixins.cybertooth.io/).

## What Does This Addon Do?
## What Does This Add-on Do?

This addon supplies the following _components_:
This add-on supplies the following _components_:

* `input-text` - a simple extension of the Ember text component that includes the following mixins:
`ctrl-enter-submits-form.js` (**disabled** by default), `enter-submits-form.js` (**enabled** by default),
Expand All @@ -69,14 +79,6 @@ Also available are the following _mixins_. You can incorporate their behaviours
_Further information about these items can be found in the Usage section below and in the
[demo (dummy) application](http://ember-cli-text-support-mixins.cybertooth.io/)._

### Dependencies

#### From NPM

The following NPM dependency is automatically installed into your Ember product:

* `keyevent` - https://github.com/cybertoothca/keyevent -

## Usage

As mentioned above there are several examples on the demonstration site:
Expand Down Expand Up @@ -200,7 +202,7 @@ _None...at least that I can think of._

---

# Ember Addon Building And Testing
# Ember Add-on Building And Testing

## Setup

Expand All @@ -210,12 +212,6 @@ _None...at least that I can think of._
git clone [email protected]:cybertoothca/ember-cli-text-support-mixins.git
```

### With NPM

```
npm install
```

### With Yarn

```
Expand All @@ -227,43 +223,41 @@ yarn
* `ember server`
* Visit your app at http://localhost:4200.

## Running Addon Tests
## Running Add-on Tests

* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions)
* `npm test` (Runs `ember try:testall` to test your add-on against multiple Ember versions)
* `ember test`
* `ember test --server`

## Building The Addon
## Building The Add-on

* `ember build`

For more information on using ember-cli, visit [http://ember-cli.com/](http://ember-cli.com/).

# Linking This Addon For Local Testing
# Linking This Add-on For Local Testing

## Linking

1. From the command line at the root of __this__ project run the
`npm link` command to _link_ this addon within your local
node repository.
1. From the _other_ Ember project that you wish to test this addon
in, execute the following command:
`npm link ember-cli-text-support-mixins`.
1. Now in that same _other_ Ember project, you should go into the
`package.json` and add the ember addon with the version _*_. It will
look something like this: `"ember-cli-text-support-mixins": "*"`. Now
when/if you execute `npm install` on this _other_ project it
will know to look for the linked addon rather than fetch it from
the central repository.
Use yarn.

```bash
# from this add-on project
$ yarn link
# from the other project that depends on this add-on
$ yarn link ember-cli-text-support-mixins
```

## Unlinking

1. Remove the addon from your local node repository with the following
command (that can be run anywhere):
`npm uninstall -g ember-cli-text-support-mixins`
1. Remove the reference to the `ember-cli-text-support-mixins`
in your _other_ project's `package.json`.
1. Run an `npm prune` and `bower prune` from the root of your _other_ project's command line.
Again, use yarn.

```bash
# from the other project that linked to this add-on
$ yarn unlink ember-cli-text-support-mixins
# from this add-on project
$ yarn unlink
```

# Deploying The Dummy Application

Expand Down
16 changes: 16 additions & 0 deletions addon/mixins/closest-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { computed } from '@ember/object';
import Mixin from '@ember/object/mixin';

/**
* Simply use the component's `element` to find it's `closest('form')`.
*/
export default Mixin.create({
/**
* Grab the nearest form. Normally you can just ask an input for it's `this.form`, however that doesn't
* seem to work with Ember wrapped TextSupport components? Using a jQuery find of the closest form instead.
* @private
*/
_form: computed(function () {
return this.element.closest('form');
})
});
13 changes: 10 additions & 3 deletions addon/mixins/escape-key-clears.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isPresent } from '@ember/utils';
import { trySet } from '@ember/object';
import Mixin from '@ember/object/mixin';

/**
Expand All @@ -11,19 +12,24 @@ export default Mixin.create({
* The function will receive two parameters: the first is the DOM event, and the second is
* `this` component.
*/
afterClearAction: undefined,
afterClearAction() {
// override accordingly
},

/**
* Pass in a closure function to fire before the value is cleared.
* The function will receive two parameters: the first is the DOM event, and the second is
* `this` component.
*/
beforeClearAction: undefined,
beforeClearAction() {
// override accordingly
},

/**
* By default, pressing the ESC key will clear this' `value` property. Set this to `false` if you do not
* want this behaviour.
*/

'escapeKeyClears?': true,

/**
Expand All @@ -37,7 +43,8 @@ export default Mixin.create({
this.get('beforeClearAction')(event, this);
}

this.set('value', '');
this.element.value = ''; // for Ember-2.4 & Ember-2.8
trySet(this, 'value', '');

// fire the after-clear action
if (isPresent(this.get('afterClearAction'))) {
Expand Down
Loading

0 comments on commit 3abf269

Please sign in to comment.