Skip to content

Commit

Permalink
Update readme (#83)
Browse files Browse the repository at this point in the history
* chore(enable isVisible test helper in consumers)

* chore(update README for ember-popper 0.7 upgrade)
  • Loading branch information
kybishop committed Nov 3, 2017
1 parent c038955 commit 6558ddd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Build Status](https://travis-ci.org/kybishop/ember-attacher.svg)](https://travis-ci.org/kybishop/ember-attacher)

Tooltips and popovers made easy.
Just drop an attach-tooltip or ember-attacher in a parent and your popper is ready to go!
Just drop an `{{#attach-tooltip}} or `{{#attach-popover}}` in a parent and your popper is ready to go!

```html
<button>
Expand All @@ -21,12 +21,12 @@ Just drop an attach-tooltip or ember-attacher in a parent and your popper is rea
<button class="other-button">
No click me!

{{#ember-attacher class="ember-attacher-popper"
{{#attach-popover class="ember-attacher-popper"
hideOn='click'
isShown=true
showOn='click'}}
I'm a popover!
{{/ember-attacher}}
{{/attach-popover}}
</button>
```

Expand All @@ -41,21 +41,53 @@ ember install ember-attacher

## Components

### `{{#ember-attacher}}`
### `{{#attach-popover}}`

The base component.
A popover attacher.
- Has no default class or roles.
- Does not modify the target in any way.
- Adds `aria-hidden` attribute to the popper element

### `{{#attach-tooltip}}`

A tooltip attacher.
A tooltip attacher. Subclass of `{{#attach-popover}}`
- Has the default class `'ember-attacher-popper ember-attacher-tooltip'`
- The default tooltip classes can be modified by altering the `tooltipClass`
default. See [here](#user-defined-defaults) for details on editing default values.
- Default `role` attribute of `tooltip`.
- Causes the target to gain an `aria-describedby` attribute set to the tooltip's ID.

## Testing

Use the `isVisible()` test helper to check if an attachment is visible.

```javascript
import { click, find } from 'ember-native-dom-helpers';
import { isVisible } from 'ember-attacher';

test('example', async function(assert) {
this.render(hbs`
<button id="toggle">
Click me, captain!
{{#attach-popover id='attachment'
hideOn='click'
showOn='click'}}
Click-toggled popover
{{/attach-popover}}
</button>
`);

const attachment = find('#attachment');

assert.equal(isVisible(attachment), false, 'Initially hidden');

await click('#toggle');

// You can also pass in a selector
assert.equal(isVisible('#attachment'), true, 'Now shown');
});
```

## User-defined defaults

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"ember-cli-babel": "^6.8.2",
"ember-cli-htmlbars": "^2.0.2",
"ember-cli-sass": "^7.0.0",
"ember-native-dom-helpers": "^0.5.3",
"ember-popper": "^0.7.2",
"ember-truth-helpers": "^2.0.0",
"eslint-plugin-ember-suave": "^1.0.0"
Expand All @@ -56,7 +57,6 @@
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"ember-native-dom-event-dispatcher": "^0.6.3",
"ember-native-dom-helpers": "^0.5.3",
"ember-power-select": "^1.9.11",
"ember-raf-test-waiter": "^0.1.0",
"ember-resolver": "^4.5.0",
Expand Down

0 comments on commit 6558ddd

Please sign in to comment.