-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from sandydoo/fix-modifier-manager-deprecation
- Loading branch information
Showing
10 changed files
with
233 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{#if (has-block)}} | ||
{{yield (hash setup=this.getInput)}} | ||
{{else}} | ||
<input id={{this.id}} ...attributes {{did-insert this.getInput}} /> | ||
<input id={{this.id}} ...attributes {{g-map/did-insert this.getInput}} /> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<div id={{@id}} class="ember-google-map" ...attributes {{did-insert @onCanvasReady}}>{{yield}}</div> | ||
<div id={{@id}} class="ember-google-map" ...attributes {{g-map/did-insert @onCanvasReady}}>{{yield}}</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{{#if this.container}} | ||
{{#in-element this.container}} | ||
{{!-- Compatibility: @classNames should be deprecated --}} | ||
<div id={{this.id}} class={{@classNames}} ...attributes {{did-insert this.getControl}}>{{yield}}</div> | ||
<div id={{this.id}} class={{@classNames}} ...attributes {{g-map/did-insert this.getControl}}>{{yield}}</div> | ||
{{/in-element}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{{#if (has-block)}} | ||
{{#if this.container}} | ||
{{#in-element this.container}} | ||
<div id={{this.id}} ...attributes {{did-insert this.getOverlay}}>{{yield}}</div> | ||
<div id={{this.id}} ...attributes {{g-map/did-insert this.getOverlay}}>{{yield}}</div> | ||
{{/in-element}} | ||
{{/if}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { modifier } from 'ember-modifier'; | ||
import { assert } from '@ember/debug'; | ||
|
||
export default modifier(function gMapDidInsert( | ||
element, | ||
[callback, ...positional], | ||
named | ||
) { | ||
assert( | ||
'`g-map/did-insert` expects a function as its first positional argument.', | ||
typeof callback === 'function' | ||
); | ||
|
||
callback(element, positional, named); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-google-maps/modifiers/g-map/did-insert'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
module('Integration | Modifier | g-map/did-insert', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it works', async function (assert) { | ||
assert.expect(3); | ||
|
||
this.onDidInsert = (element, positional, named) => { | ||
assert.ok(element instanceof Element, 'passes the element'); | ||
assert.equal(positional.length, 1, 'passes positional args'); | ||
assert.equal(Object.keys(named).length, 1, 'passes named args'); | ||
}; | ||
|
||
await render(hbs` | ||
<div {{g-map/did-insert this.onDidInsert "positonal arg" oneMoreThing="named arg" }}></div> | ||
`); | ||
}); | ||
}); |
Oops, something went wrong.