Skip to content

Commit

Permalink
Merge branch 'master' into paper-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Oct 6, 2016
2 parents 019a1cb + 2cb9be5 commit 702bb74
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Contributions and pull requests are always welcome. Contributors may often be fo

#### 1.0.0-alpha.4
- [#466](https://github.com/miguelcobain/ember-paper/pull/466) added autoprefixer configuration option
- [#472](https://github.com/miguelcobain/ember-paper/pull/472) update ember-css-transitions
- [#511](https://github.com/miguelcobain/ember-paper/issues/511) allow inner dialog clicks to bubble
- [5f35cf5](https://github.com/miguelcobain/ember-paper/commit/5f35cf517530b06c850282a757d49096bff9a22b) Glimmer 2 compatible
- [#506](https://github.com/miguelcobain/ember-paper/pull/506) Add super calls inside paper-input lifecycle hooks (fixes paper-form)

#### 1.0.0-alpha.3
- [#441](https://github.com/miguelcobain/ember-paper/pull/441) fixed fastboot service check
Expand Down
12 changes: 10 additions & 2 deletions addon/components/paper-dialog-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ const { Component } = Ember;
export default Component.extend({
classNames: ['md-dialog-container'],

click() {
this.sendAction('outsideClicked');
mouseDown(ev) {
this._sourceEl = ev.target;
},

mouseUp(ev) {
if (this._sourceEl === this.element && ev.target === this.element) {
ev.stopPropagation();
ev.preventDefault();
this.sendAction('outsideClicked');
}
}
});
7 changes: 0 additions & 7 deletions addon/components/paper-dialog-inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ export default Component.extend(Translate3dMixin, {
if ($origin) {
$origin.focus();
}
},

click(ev) {
if (this.get('clickOutsideToClose')) {
ev.stopPropagation();
return false;
}
}

});
7 changes: 2 additions & 5 deletions app/templates/components/paper-dialog.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
opaque=true
fixed=(unless parent true)
class="md-dialog-backdrop"
onClick=(action "outsideClicked")
}}
onClick=(action "outsideClicked")}}
{{#paper-dialog-container outsideClicked=(action "outsideClicked")}}
{{#paper-dialog-inner
origin=origin
defaultedParent=defaultedParent
defaultedOpenFrom=defaultedOpenFrom
defaultedCloseTo=defaultedCloseTo
fullscreen=fullscreen
clickOutsideToClose=clickOutsideToClose
focusOnOpen=focusOnOpen
}}
focusOnOpen=focusOnOpen}}
{{yield}}
{{/paper-dialog-inner}}
{{/paper-dialog-container}}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ember-paper",
"description": "The Ember approach to Material Design.",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"directories": {
"doc": "doc",
"test": "tests"
Expand Down
3 changes: 2 additions & 1 deletion tests/dummy/app/templates/demo/dialog.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{{/if}}

{{#if showDialog}}
{{#paper-dialog onClose=(action "closeDialog" "cancel") origin=dialogOrigin}}
{{#paper-dialog onClose=(action "closeDialog" "cancel") origin=dialogOrigin clickOutsideToClose=true}}
{{#paper-toolbar}}
<div class="md-toolbar-tools">
<h2>Mango (Fruit)</h2>
Expand All @@ -110,6 +110,7 @@
{{/paper-dialog-content}}

{{#paper-dialog-actions class="layout-row"}}
{{#paper-button href="http://en.wikipedia.org/wiki/Mango" target="_blank"}}More on Wikipedia{{/paper-button}}
<span class="flex"></span>
{{#paper-button onClick=(action "closeDialog" "cancel")}}Cancel{{/paper-button}}
{{#paper-button onClick=(action "closeDialog" "ok")}}OK{{/paper-button}}
Expand Down
24 changes: 22 additions & 2 deletions tests/integration/components/paper-dialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ test('click outside should close dialog if clickOutsideToClose', function(assert

assert.ok(this.$('md-dialog').length, 'dialog is showing');

this.$('.md-dialog-container').click();
this.$('.md-dialog-container').mousedown().mouseup().click();
});

test('click outside should not close dialog by default', function(assert) {
Expand All @@ -148,7 +148,27 @@ test('click outside should not close dialog by default', function(assert) {

assert.ok(this.$('md-dialog').length, 'dialog is showing');

this.$('.md-dialog-container').click();
this.$('.md-dialog-container').mousedown().mouseup().click();
assert.ok(this.$('md-dialog').length, 'dialog is still showing');
});

test('dialog shouldn\'t swallow click events', function(assert) {
assert.expect(3);

this.$().click(() => {
assert.ok(true, 'click event bubbled up');
});

this.render(hbs`
<div id="paper-wormhole"></div>
{{#paper-dialog clickOutsideToClose=true}}
<button id="the-button">Go somewhere</button>
{{/paper-dialog}}
`);

assert.ok(this.$('md-dialog').length, 'dialog is showing');

this.$('#the-button').mousedown().mouseup().click();
assert.ok(this.$('md-dialog').length, 'dialog is still showing');
});

Expand Down

0 comments on commit 702bb74

Please sign in to comment.