diff --git a/.eslintrc.js b/.eslintrc.js index e922731d..01390bdf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,7 +29,6 @@ module.exports = { }, rules: { 'no-setter-return': 'off', - 'ember/classic-decorator-no-classic-methods': 'warn', 'ember/classic-decorator-hooks': 'warn', 'ember/no-classic-classes': 'warn', 'ember/no-classic-components': 'warn', diff --git a/tests/acceptance/basic-test.js b/tests/acceptance/basic-test.js index 39d67c4f..6ee8064a 100644 --- a/tests/acceptance/basic-test.js +++ b/tests/acceptance/basic-test.js @@ -27,26 +27,12 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { openSelector: '#example-basic button', dialogText: 'Basic', closeSelector: overlaySelector, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); await assert.dialogOpensAndCloses({ openSelector: '#example-basic button', dialogText: 'Basic', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -55,26 +41,12 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { openSelector: '#example-translucent button', dialogText: 'With Translucent Overlay', closeSelector: overlaySelector, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); await assert.dialogOpensAndCloses({ openSelector: '#example-translucent button', dialogText: 'With Translucent Overlay', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -83,26 +55,12 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { openSelector: '#example-without-overlay button', dialogText: 'Without Overlay', closeSelector: '#example-without-overlay', - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); await assert.dialogOpensAndCloses({ openSelector: '#example-without-overlay button', dialogText: 'Without Overlay', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -111,26 +69,12 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { openSelector: '#example-translucent button', dialogText: 'With Translucent Overlay', closeSelector: overlaySelector, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); await assert.dialogOpensAndCloses({ openSelector: '#example-translucent button', dialogText: 'With Translucent Overlay', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -139,26 +83,12 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { openSelector: '#example-overlay-sibling button', dialogText: 'With Translucent Overlay as Sibling', closeSelector: overlaySelector, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); await assert.dialogOpensAndCloses({ openSelector: '#example-overlay-sibling button', dialogText: 'With Translucent Overlay as Sibling', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -191,24 +121,12 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { 'custom-styles-modal-container', 'has provided container-class', ); - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); }, }); await assert.dialogOpensAndCloses({ openSelector: '#example-custom-styles button', dialogText: 'Custom Styles', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -224,11 +142,6 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { 'ember-modal-dialog-target-attachment-left', 'has targetAttachment class name', ); - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); }, }); }); @@ -238,13 +151,6 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { openSelector: '#example-target-element button', dialogText: 'Target - Element', closeSelector: dialogCloseButton, - whileOpen: async function () { - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); - }, }); }); @@ -257,11 +163,6 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { assert .dom(dialogSelector) .hasClass('my-cool-modal', 'has provided containerClassNames'); - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); }, }); }); @@ -278,11 +179,6 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { assert .dom(dialogSelector) .hasClass('my-cool-modal-2', 'has provided containerClassNames'); - assert.hasDataTest( - dialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); }, }); }); @@ -302,11 +198,6 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { assert .dom(inPlaceDialogSelector) .hasClass('my-custom-class', 'has provided containerClass'); - assert.hasDataTest( - inPlaceDialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); assert.strictEqual( getComputedStyle(dialogElement).getPropertyValue('position'), 'static', @@ -356,11 +247,6 @@ module('Acceptance: modal-dialog | no animation, no tether', function (hooks) { assert .dom(inPlaceDialogSelector) .hasClass('my-custom-class-2', 'has provided containerClassNames'); - assert.hasDataTest( - inPlaceDialogSelector, - 'my-data-test', - 'dialog has data-test attribute', - ); await click(inPlaceCloseButton); }); }); diff --git a/tests/dummy/app/components/component-that-uses-modal-dialog.hbs b/tests/dummy/app/components/component-that-uses-modal-dialog.hbs deleted file mode 100644 index 08a4e259..00000000 --- a/tests/dummy/app/components/component-that-uses-modal-dialog.hbs +++ /dev/null @@ -1,17 +0,0 @@ -{{#if this.isShowingModalDialog}} - -

Stop! Modal Time!

- -
-{{/if}} - -

A component that has a modal dialog

- \ No newline at end of file diff --git a/tests/dummy/app/components/component-that-uses-modal-dialog.js b/tests/dummy/app/components/component-that-uses-modal-dialog.js deleted file mode 100644 index 65daa6fe..00000000 --- a/tests/dummy/app/components/component-that-uses-modal-dialog.js +++ /dev/null @@ -1,16 +0,0 @@ -import Component from '@ember/component'; -import { action, set } from '@ember/object'; - -export default class ComponentThatUsesModalDialog extends Component { - isShowingModalDialog = false; - - @action - openModalDialog() { - set(this, 'isShowingModalDialog', true); - } - - @action - closeModalDialog() { - set(this, 'isShowingModalDialog', false); - } -} diff --git a/tests/dummy/app/components/demo-modal.hbs b/tests/dummy/app/components/demo-modal.hbs new file mode 100644 index 00000000..88b0da13 --- /dev/null +++ b/tests/dummy/app/components/demo-modal.hbs @@ -0,0 +1,34 @@ +
+

{{@title}}

+ +
+ {{yield + (hash + OpenButton=(component + "demo-modal/button" + label="Open" + onClick=this.openModal + ) + ) + to="menu" + }} +
+ +
+ {{yield to="code"}} +
+ +
+ {{yield + (hash + CloseButton=(component + "demo-modal/button" + label="Close" + onClick=this.closeModal + ) + closeModal=this.closeModal + isModalOpen=this.isModalOpen + ) + }} +
+
\ No newline at end of file diff --git a/tests/dummy/app/components/demo-modal.js b/tests/dummy/app/components/demo-modal.js new file mode 100644 index 00000000..14a6a51b --- /dev/null +++ b/tests/dummy/app/components/demo-modal.js @@ -0,0 +1,19 @@ +import { action } from '@ember/object'; +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; + +export default class DemoModal extends Component { + @tracked isModalOpen = false; + + @action closeModal() { + this.isModalOpen = false; + + this.args.onClose?.(); + } + + @action openModal() { + this.isModalOpen = true; + + this.args.onOpen?.(); + } +} diff --git a/tests/dummy/app/components/demo-modal/button.hbs b/tests/dummy/app/components/demo-modal/button.hbs new file mode 100644 index 00000000..c84c9343 --- /dev/null +++ b/tests/dummy/app/components/demo-modal/button.hbs @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/tests/dummy/app/components/demo-modal/button.js b/tests/dummy/app/components/demo-modal/button.js new file mode 100644 index 00000000..5c9132f8 --- /dev/null +++ b/tests/dummy/app/components/demo-modal/button.js @@ -0,0 +1,5 @@ +import templateOnlyComponent from '@ember/component/template-only'; + +const DemoModalButton = templateOnlyComponent(); + +export default DemoModalButton; diff --git a/tests/dummy/app/controllers/animatable.js b/tests/dummy/app/controllers/animatable.js index 4752cf1b..d919e58f 100644 --- a/tests/dummy/app/controllers/animatable.js +++ b/tests/dummy/app/controllers/animatable.js @@ -1,94 +1,7 @@ import Controller from '@ember/controller'; -import { set, action } from '@ember/object'; import { codeSnippets } from '../utils/code-snippets/animatable'; export default class AnimatableController extends Controller { codeSnippets = codeSnippets; - - isShowingBasic = false; - isShowingTranslucent = false; - isShowingTranslucentWithCallback = false; - isShowingWithoutOverlay = false; - isShowingWithoutOverlayClickOutsideToClose = false; - isShowingWithoutOverlayClickOutsideToCloseAnotherOne = false; - isShowingSubclassed = false; - isShowingCenteredScrolling = false; - isShowingElementCenterModal = false; - - nextAttachment(val) { - switch (val) { - case 'middle right': - return 'bottom center'; - case 'bottom center': - return 'middle left'; - case 'middle left': - return 'top center'; - case 'top center': - return 'middle right'; - } - return false; - } - - @action - toggleActiveComponent() { - if (this.activeComponent === 'modal-dialog') { - set(this, 'activeComponent', 'tether-dialog'); - } else { - set(this, 'activeComponent', 'modal-dialog'); - } - } - - @action - toggleBasic() { - this.toggleProperty('isShowingBasic'); - } - - @action - toggleTranslucent() { - this.toggleProperty('isShowingTranslucent'); - } - - @action - toggleTranslucentWithCallback() { - this.toggleProperty('isShowingTranslucentWithCallback'); - } - - @action - toggleWithoutOverlay() { - this.toggleProperty('isShowingWithoutOverlay'); - } - - @action - toggleWithoutOverlayClickOutsideToClose() { - this.toggleProperty('isShowingWithoutOverlayClickOutsideToClose'); - } - - @action - toggleWithoutOverlayClickOutsideToCloseAnotherOne() { - this.toggleProperty('isShowingWithoutOverlayClickOutsideToCloseAnotherOne'); - } - - @action - toggleSubclassed() { - this.toggleProperty('isShowingSubclassed'); - } - - @action - toggleCenteredScrolling() { - this.toggleProperty('isShowingCenteredScrolling'); - - if (this.isShowingCenteredScrolling) { - document.querySelector('#modal-overlays').classList.add('active'); - document.body.classList.add('centered-modal-showing'); - } else { - document.querySelector('#modal-overlays').classList.remove('active'); - document.body.classList.remove('centered-modal-showing'); - } - } - - @action - clickedTranslucentOverlay() { - window.onClickOverlayCallbackCalled = true; - } } diff --git a/tests/dummy/app/controllers/index.js b/tests/dummy/app/controllers/index.js index b0d6bf23..f06d93a2 100644 --- a/tests/dummy/app/controllers/index.js +++ b/tests/dummy/app/controllers/index.js @@ -1,28 +1,14 @@ -import { action, set } from '@ember/object'; +import { action } from '@ember/object'; import Controller from '@ember/controller'; +import { tracked } from '@glimmer/tracking'; import { codeSnippets } from '../utils/code-snippets/index'; export default class IndexController extends Controller { codeSnippets = codeSnippets; - isShowingBasic = false; - isShowingTranslucent = false; - isShowingTranslucentWithCallback = false; - isShowingWithoutOverlay = false; - isShowingWithoutOverlayClickOutsideToClose = false; - isShowingWithoutOverlayClickOutsideToCloseAnotherOne = false; - isShowingCustomStyles = false; - isShowingTargetSelector = false; - isShowingTargetElement = false; - isShowingSubclassed = false; - isShowingSubclassed2 = false; - isShowingInPlace = false; - isShowingCenteredScrolling = false; - isShowingElementCenterModal = false; - exampleTargetAttachment = 'middle left'; - exampleAttachment = 'middle right'; - customContainerClassNames = 'custom-styles-modal-container'; + @tracked exampleTargetAttachment = 'middle left'; + @tracked exampleAttachment = 'middle right'; nextAttachment(val) { switch (val) { @@ -38,67 +24,27 @@ export default class IndexController extends Controller { return false; } - @action - toggleTargetSelector() { - if (this.isShowingTargetSelector) { - let newTargetAttachment = this.nextAttachment( - this.exampleTargetAttachment, - ); - let newAttachment = this.nextAttachment(this.exampleAttachment); - set(this, 'exampleTargetAttachment', newTargetAttachment); - set(this, 'exampleAttachment', newAttachment); - if (newTargetAttachment !== 'middle left') { - return; - } - } - this.toggleProperty('isShowingTargetSelector'); + @action onClickTranslucentOverlay() { + window.onClickOverlayCallbackCalled = true; } - @action - toggleTargetElement() { - if (this.isShowingTargetElement) { - let newTargetAttachment = this.nextAttachment( - this.exampleTargetAttachment, - ); - let newAttachment = this.nextAttachment(this.exampleAttachment); - set(this, 'exampleTargetAttachment', newTargetAttachment); - set(this, 'exampleAttachment', newAttachment); - if (newTargetAttachment !== 'middle left') { - return; - } - } - this.toggleProperty('isShowingTargetElement'); + @action onCloseCenteredScrolling() { + document.querySelector('#modal-overlays').classList.remove('active'); + document.body.classList.remove('centered-modal-showing'); } - @action - toggleCenteredScrolling() { - this.toggleProperty('isShowingCenteredScrolling'); - - if (this.isShowingCenteredScrolling) { - document.querySelector('#modal-overlays').classList.add('active'); - document.body.classList.add('centered-modal-showing'); - } else { - document.querySelector('#modal-overlays').classList.remove('active'); - document.body.classList.remove('centered-modal-showing'); - } + @action onOpenCenteredScrolling() { + document.querySelector('#modal-overlays').classList.add('active'); + document.body.classList.add('centered-modal-showing'); } - @action - closeTargetSelector() { - set(this, 'isShowingTargetSelector', false); - set(this, 'exampleTargetAttachment', 'middle left'); - set(this, 'exampleAttachment', 'middle right'); - } - - @action - closeTargetElement() { - set(this, 'isShowingTargetElement', false); - set(this, 'exampleTargetAttachment', 'middle left'); - set(this, 'exampleAttachment', 'middle right'); - } + @action toggleTarget() { + const newTargetAttachment = this.nextAttachment( + this.exampleTargetAttachment, + ); + const newAttachment = this.nextAttachment(this.exampleAttachment); - @action - clickedTranslucentOverlay() { - window.onClickOverlayCallbackCalled = true; + this.exampleTargetAttachment = newTargetAttachment; + this.exampleAttachment = newAttachment; } } diff --git a/tests/dummy/app/controllers/tethered-animatable.js b/tests/dummy/app/controllers/tethered-animatable.js index a030eca9..b52cc55f 100644 --- a/tests/dummy/app/controllers/tethered-animatable.js +++ b/tests/dummy/app/controllers/tethered-animatable.js @@ -1,24 +1,17 @@ import Controller from '@ember/controller'; -import { set, action } from '@ember/object'; +import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; import { codeSnippets } from '../utils/code-snippets/tethered-animatable'; export default class TetheredAnimatableController extends Controller { codeSnippets = codeSnippets; - isShowingBasic = false; - isShowingTranslucent = false; - isShowingTranslucentWithCallback = false; - isShowingWithoutOverlay = false; - isShowingWithoutOverlayClickOutsideToClose = false; - isShowingWithoutOverlayClickOutsideToCloseAnotherOne = false; - isShowingTargetSelector = false; - isShowingTargetElement = false; - isShowingSubclassed = false; - isShowingCenteredScrolling = false; - isShowingElementCenterModal = false; - exampleTargetAttachment = 'middle left'; - exampleAttachment = 'middle right'; + @tracked exampleTargetAttachment = 'middle left'; + @tracked exampleAttachment = 'middle right'; + @tracked isShowingSeparateStacksModal1 = false; + @tracked isShowingSeparateStacksModal2 = false; + @tracked isShowingSeparateStacksModal3 = false; nextAttachment(val) { switch (val) { @@ -34,121 +27,37 @@ export default class TetheredAnimatableController extends Controller { return false; } - @action - toggleActiveComponent() { - if (this.activeComponent === 'modal-dialog') { - set(this, 'activeComponent', 'tether-dialog'); - } else { - set(this, 'activeComponent', 'modal-dialog'); - } - } - - @action - toggleBasic() { - this.toggleProperty('isShowingBasic'); + @action closeSeparateStackModal1() { + this.isShowingSeparateStacksModal1 = false; } - @action - toggleTranslucent() { - this.toggleProperty('isShowingTranslucent'); + @action closeSeparateStackModal2() { + this.isShowingSeparateStacksModal2 = false; } - @action - toggleTranslucentWithCallback() { - this.toggleProperty('isShowingTranslucentWithCallback'); + @action closeSeparateStackModal3() { + this.isShowingSeparateStacksModal3 = false; } - @action - toggleWithoutOverlay() { - this.toggleProperty('isShowingWithoutOverlay'); + @action openSeparateStackModal1() { + this.isShowingSeparateStacksModal1 = true; } - @action - toggleWithoutOverlayClickOutsideToClose() { - this.toggleProperty('isShowingWithoutOverlayClickOutsideToClose'); - } - - @action - toggleWithoutOverlayClickOutsideToCloseAnotherOne() { - this.toggleProperty('isShowingWithoutOverlayClickOutsideToCloseAnotherOne'); - } - - @action - toggleTargetSelector() { - if (this.isShowingTargetSelector) { - let newTargetAttachment = this.nextAttachment( - this.exampleTargetAttachment, - ); - let newAttachment = this.nextAttachment(this.exampleAttachment); - set(this, 'exampleTargetAttachment', newTargetAttachment); - set(this, 'exampleAttachment', newAttachment); - if (newTargetAttachment !== 'middle left') { - return; - } - } - this.toggleProperty('isShowingTargetSelector'); - } - - @action - toggleTargetElement() { - if (this.isShowingTargetElement) { - let newTargetAttachment = this.nextAttachment( - this.exampleTargetAttachment, - ); - let newAttachment = this.nextAttachment(this.exampleAttachment); - set(this, 'exampleTargetAttachment', newTargetAttachment); - set(this, 'exampleAttachment', newAttachment); - if (newTargetAttachment !== 'middle left') { - return; - } - } - this.toggleProperty('isShowingTargetElement'); + @action openSeparateStackModal2() { + this.isShowingSeparateStacksModal2 = true; } - @action - toggleSubclassed() { - this.toggleProperty('isShowingSubclassed'); + @action openSeparateStackModal3() { + this.isShowingSeparateStacksModal3 = true; } - @action - toggleCenteredScrolling() { - this.toggleProperty('isShowingCenteredScrolling'); - - if (this.isShowingCenteredScrolling) { - document.querySelector('#modal-overlays').classList.add('active'); - document.body.classList.add('centered-modal-showing'); - } else { - document.querySelector('#modal-overlays').classList.remove('active'); - document.body.classList.remove('centered-modal-showing'); - } - } - - @action - toggleElementCenterModal() { - this.toggleProperty('isShowingElementCenterModal'); - if (this.isShowingElementCenterModal) { - set(this, 'targetAttachment', 'elementCenter'); - set(this, 'exampleTargetAttachment', 'elementCenter'); - set(this, 'exampleAttachment', 'elementCenter'); - } - } - - @action - closeTargetSelector() { - set(this, 'isShowingTargetSelector', false); - set(this, 'exampleTargetAttachment', 'middle left'); - set(this, 'exampleAttachment', 'middle right'); - } - - @action - closeTargetElement() { - set(this, 'isShowingTargetElement', false); - set(this, 'exampleTargetAttachment', 'middle left'); - set(this, 'exampleAttachment', 'middle right'); - } + @action toggleTarget() { + const newTargetAttachment = this.nextAttachment( + this.exampleTargetAttachment, + ); + const newAttachment = this.nextAttachment(this.exampleAttachment); - @action - clickedTranslucentOverlay() { - window.onClickOverlayCallbackCalled = true; + this.exampleTargetAttachment = newTargetAttachment; + this.exampleAttachment = newAttachment; } } diff --git a/tests/dummy/app/controllers/tethered.js b/tests/dummy/app/controllers/tethered.js index ef3fa3aa..e0b8ffc7 100644 --- a/tests/dummy/app/controllers/tethered.js +++ b/tests/dummy/app/controllers/tethered.js @@ -1,16 +1,14 @@ -import { action, set } from '@ember/object'; +import { action } from '@ember/object'; import Controller from '@ember/controller'; +import { tracked } from '@glimmer/tracking'; import { codeSnippets } from '../utils/code-snippets/tethered'; export default class TetheredController extends Controller { codeSnippets = codeSnippets; - isShowingTargetSelector = false; - isShowingTargetElement = false; - isShowingElementCenterModal = false; - exampleTargetAttachment = 'middle left'; - exampleAttachment = 'middle right'; + @tracked exampleTargetAttachment = 'middle left'; + @tracked exampleAttachment = 'middle right'; nextAttachment(val) { switch (val) { @@ -26,49 +24,13 @@ export default class TetheredController extends Controller { return false; } - @action - toggleTargetSelector() { - if (this.isShowingTargetSelector) { - let newTargetAttachment = this.nextAttachment( - this.exampleTargetAttachment, - ); - let newAttachment = this.nextAttachment(this.exampleAttachment); - set(this, 'exampleTargetAttachment', newTargetAttachment); - set(this, 'exampleAttachment', newAttachment); - if (newTargetAttachment !== 'middle left') { - return; - } - } - this.toggleProperty('isShowingTargetSelector'); - } - - @action - toggleTargetElement() { - if (this.isShowingTargetElement) { - let newTargetAttachment = this.nextAttachment( - this.exampleTargetAttachment, - ); - let newAttachment = this.nextAttachment(this.exampleAttachment); - set(this, 'exampleTargetAttachment', newTargetAttachment); - set(this, 'exampleAttachment', newAttachment); - if (newTargetAttachment !== 'middle left') { - return; - } - } - this.toggleProperty('isShowingTargetElement'); - } - - @action - closeTargetSelector() { - set(this, 'isShowingTargetSelector', false); - set(this, 'exampleTargetAttachment', 'middle left'); - set(this, 'exampleAttachment', 'middle right'); - } + @action toggleTarget() { + const newTargetAttachment = this.nextAttachment( + this.exampleTargetAttachment, + ); + const newAttachment = this.nextAttachment(this.exampleAttachment); - @action - closeTargetElement() { - set(this, 'isShowingTargetElement', false); - set(this, 'exampleTargetAttachment', 'middle left'); - set(this, 'exampleAttachment', 'middle right'); + this.exampleTargetAttachment = newTargetAttachment; + this.exampleAttachment = newAttachment; } } diff --git a/tests/dummy/app/styles/app.css b/tests/dummy/app/styles/app.css index 02f6be02..ce1c2a0f 100644 --- a/tests/dummy/app/styles/app.css +++ b/tests/dummy/app/styles/app.css @@ -128,6 +128,7 @@ body.centered-modal-showing { top: 0; left: 0; overflow-y: scroll; + z-index: 1; } .centered-scrolling-overlay { diff --git a/tests/dummy/app/templates/animatable.hbs b/tests/dummy/app/templates/animatable.hbs index af1c2fd0..7647d483 100644 --- a/tests/dummy/app/templates/animatable.hbs +++ b/tests/dummy/app/templates/animatable.hbs @@ -22,258 +22,214 @@ /> -
-

Basic

- - - - - - {{#if this.isShowingBasic}} - -

Stop! Modal Time!

-

Basic

- -
- {{/if}} -
- -
-

With Translucent Overlay

- - - - - - {{#if this.isShowingTranslucent}} - -

Stop! Modal Time!

-

With Translucent Overlay

- -
- {{/if}} -
- -
-

Without Overlay

- - - - - - {{#if this.isShowingWithoutOverlay}} - -

Stop! Modal Time!

-

Without Overlay

- -
- {{/if}} -
- -
+ <:menu as |M|> + + + + <:code> + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Basic

+ +
+ {{/if}} + + + + -

Without Overlay - Click Outside to Close

- - - - - - - {{#if this.isShowingWithoutOverlayClickOutsideToClose}} - + + + + <:code> + -

Stop! Modal Time!

-

Without Overlay - Click Outside to Close

- -
- {{/if}} - - {{#if - this.isShowingWithoutOverlayClickOutsideToCloseAnotherOne - }} - Stop! Modal Time! +

With Translucent Overlay

+ +
+ {{/if}} + +
+ + + <:menu as |M|> + + + + <:code> + -

Stop! Another modal!

-

Without Overlay Another One - Click Outside to Close

- - - {{/if}} -
- -
-

Custom Styles

- - - - - - - - {{#if this.isShowingCustomStyles}} - -

Stop! Modal Time!

-

Custom Styles

- -
- {{/if}} -
- -
-

Via Subclass

- - - - - - - - - - {{#if this.isShowingSubclassed}} - -

Stop! Modal Time!

-

Via Subclass

- -
- {{/if}} -
\ No newline at end of file +

Stop! Modal Time!

+

Without Overlay - Click Outside to Close

+ + + {{/if}} + + + + + <:menu as |M|> + + + + <:code> + + + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Custom Styles

+ +
+ {{/if}} + +
+ + + <:menu as |M|> + + + + <:code> + + + + + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Via Subclass

+ +
+ {{/if}} + +
\ No newline at end of file diff --git a/tests/dummy/app/templates/index.hbs b/tests/dummy/app/templates/index.hbs index f345d92a..606df1d0 100644 --- a/tests/dummy/app/templates/index.hbs +++ b/tests/dummy/app/templates/index.hbs @@ -23,587 +23,509 @@ is passed.

-
-

Basic

- - - - - - {{#if this.isShowingBasic}} - -

Stop! Modal Time!

-

Basic

- -
- {{/if}} -
- -
-

With Translucent Overlay

- - - - - - {{#if this.isShowingTranslucent}} - -

Stop! Modal Time!

-

With Translucent Overlay

- -
- {{/if}} -
- -
-

Translucent Overlay with Callback

- - - - - - {{#if this.isShowingTranslucentWithCallback}} - + <:menu as |M|> + + + + <:code> + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Basic

+ +
+ {{/if}} + + + + + <:menu as |M|> + + + + <:code> + -

Stop! Modal Time!

-

Translucent Overlay with Callback

- -
- {{/if}} -
- -
-

Without Overlay

- - - - - - {{#if this.isShowingWithoutOverlay}} - Stop! Modal Time! +

With Translucent Overlay

+ +
+ {{/if}} + + + + + <:menu as |M|> + + + + <:code> + -

Stop! Modal Time!

-

Without Overlay

- - - {{/if}} -
- -
-

With Overlay as a Sibling in the DOM

- - - - - - {{#if this.isShowingSibling}} - -

Stop! Modal Time!

-

With Translucent Overlay as Sibling

- -
- {{/if}} -
- -
-

Custom Styles

- - - - - - - - {{#if this.isShowingCustomStyles}} - -

Stop! Modal Time!

-

Custom Styles

- -
- {{/if}} -
-
-

Target (Selector)

- -
- -
- - - - {{#if this.isShowingTargetSelector}} - -

Stop! Modal Time!

-

Target - Selector: "#alignModalDialogToMe"

-

Target Attachment: {{this.exampleTargetAttachment}}

-

Attachment: {{this.exampleAttachment}}

- -
- {{/if}} -
- -
-

Target (Element)

- -
- - - -
- - - - {{#if this.isShowingTargetElement}} - -

Stop! Modal Time!

-

Target - Element #bwmde

-

Target Attachment: {{this.exampleTargetAttachment}}

-

Attachment: {{this.exampleAttachment}}

- -
- {{/if}} -
- -
-

Via Subclass

- - - - - - - - - - {{#if this.isShowingSubclassed}} - -

Stop! Modal Time!

-

Via Subclass

- -
- {{/if}} -
- -
-

Via Subclass

- - - - - - - - - - {{#if this.isShowingSubclassed2}} - -

Stop! Modal Time!

-

Via Subclass

- -
- {{/if}} -
- -
-

In Place

- - - - - - - -
- I AM THE CONTAINER - {{#if this.isShowingInPlace}} +

Stop! Modal Time!

+

Without Overlay

+ + + {{/if}} + + + + + <:menu as |M|> + + + + <:code> + + + + <:default as |D|> + {{#if D.isModalOpen}}

Stop! Modal Time!

-

In Place

- +

With Translucent Overlay as Sibling

+
{{/if}} -
-
- -
-

In Place

- - - - - - - -
- I AM THE CONTAINER - {{#if this.isShowingInPlace2}} + + + + + <:menu as |M|> + + + + <:code> + + + + + + <:default as |D|> + {{#if D.isModalOpen}}

Stop! Modal Time!

-

In Place

- +

Custom Styles

+
{{/if}} -
-
- -
-

Centered Scrolling

- - - - - - - -
- {{#if this.isShowingCenteredScrolling}} + + + + + <:menu as |M|> + + + + <:code> + + + + <:default as |D|> + {{#if D.isModalOpen}} -

Really Long Content To Demonstrate Scrolling

-
    -
  • Hover over modal and scroll
  • -
  • Also hover over overlay and scroll
  • -
- {{lorem-ipsum length=30000}} - +

Stop! Modal Time!

+

Target - Selector: "#alignModalDialogToMe"

+

Target Attachment: + {{this.exampleTargetAttachment}}

+

Attachment: {{this.exampleAttachment}}

+
{{/if}} -
-
+ + + + + <:menu as |M|> + + + + -
-

Element Center

+ <:code> + + - - - - - - - {{#if this.isShowingElementCenterModal}} - + + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Via Subclass

+ +
+ {{/if}} + + + + + <:menu as |M|> + + + + <:code> + + + -

Centered on element.

-
- {{/if}} -
\ No newline at end of file + @language="hbs" + /> + + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Via Subclass

+ +
+ {{/if}} + +
+ + + <:menu as |M|> + + + + <:code> + + + + + + <:default as |D|> +
+ I AM THE CONTAINER + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

In Place

+ +
+ {{/if}} +
+ +
+ + + <:menu as |M|> + + + + <:code> + + + + + + <:default as |D|> +
+ I AM THE CONTAINER + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

In Place

+ +
+ {{/if}} +
+ +
+ + + <:menu as |M|> + + + + <:code> + + + + + + <:default as |D|> +
+ {{#if D.isModalOpen}} + +

Really Long Content To Demonstrate Scrolling

+
    +
  • Hover over modal and scroll
  • +
  • Also hover over overlay and scroll
  • +
+ {{lorem-ipsum length=30000}} + +
+ {{/if}} +
+ +
+ + + <:menu as |M|> + + + + + + <:code> + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Centered on element.

+
+ {{/if}} + +
\ No newline at end of file diff --git a/tests/dummy/app/templates/tethered-animatable.hbs b/tests/dummy/app/templates/tethered-animatable.hbs index a5b92cec..4119d4ba 100644 --- a/tests/dummy/app/templates/tethered-animatable.hbs +++ b/tests/dummy/app/templates/tethered-animatable.hbs @@ -37,192 +37,179 @@ /> -
-

Custom Styles

+ + <:menu as |M|> + + - - - + <:code> + - + + - {{#if this.isShowingCustomStyles}} - -

Stop! Modal Time!

-

Custom Styles

- -
- {{/if}} -
- -
-

Target (Selector)

+

Stop! Modal Time!

+

Custom Styles

+ + + {{/if}} + + -
- -
+ + <:menu as |M|> + + - + <:code> + + - {{#if this.isShowingTargetSelector}} - -

Stop! Modal Time!

-

Target - Selector: "#alignTetherDialogToMe"

-

Target Attachment: {{this.exampleTargetAttachment}}

-

Attachment: {{this.exampleAttachment}}

- -
- {{/if}} -
+ <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Target - Selector: "#alignTetherDialogToMe"

+

Target Attachment: + {{this.exampleTargetAttachment}}

+

Attachment: {{this.exampleAttachment}}

+ +
+ {{/if}} + + -
-

Target (Element)

-
+ + <:menu as |M|> - + -
+ - - - {{#if this.isShowingTargetElement}} - -

Stop! Modal Time!

-

Target - Element #bwtde

-

Target Attachment: {{this.exampleTargetAttachment}}

-

Attachment: {{this.exampleAttachment}}

- -
- {{/if}} -
+ <:code> + + -
-

Element Center

+ <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Target - Element #bwtde

+

Target Attachment: + {{this.exampleTargetAttachment}}

+

Attachment: {{this.exampleAttachment}}

+ +
+ {{/if}} + + - - - + + <:menu as |M|> + + + + - + <:code> + + - {{#if this.isShowingElementCenterModal}} - -

Centered on element.

-
- {{/if}} -
+ <:default as |D|> + {{#if D.isModalOpen}} + +

Centered on element.

+
+ {{/if}} + +

Separate Stacks

@@ -243,10 +230,7 @@ -
-

Custom Styles

- - - - - - - - {{#if this.isShowingCustomStyles}} - -

Stop! Modal Time!

-

Custom Styles

- -
- {{/if}} -
- -
-

Target (Selector)

- -
- -
- - - - {{#if this.isShowingTargetSelector}} - -

Stop! Modal Time!

-

Target - Selector: "#alignTetherDialogToMe"

-

Target Attachment: {{this.exampleTargetAttachment}}

-

Attachment: {{this.exampleAttachment}}

- -
- {{/if}} -
- -
-

Target (Element)

- -
+

Stop! Modal Time!

+

Custom Styles

+ + + {{/if}} + + + + + <:menu as |M|> + + + + <:code> + + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Target - Selector: "#alignTetherDialogToMe"

+

Target Attachment: + {{this.exampleTargetAttachment}}

+

Attachment: {{this.exampleAttachment}}

+ +
+ {{/if}} + +
+ + + <:menu as |M|> - + -
- - - - {{#if this.isShowingTargetElement}} - -

Stop! Modal Time!

-

Target - Element #bwtde

-

Target Attachment: {{this.exampleTargetAttachment}}

-

Attachment: {{this.exampleAttachment}}

- -
- {{/if}} -
+ -
-

Element Center

- - - - - - + @language="hbs" + /> + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Stop! Modal Time!

+

Target - Element #bwtde

+

Target Attachment: + {{this.exampleTargetAttachment}}

+

Attachment: {{this.exampleAttachment}}

+ +
+ {{/if}} + + + + + <:menu as |M|> + + + + - {{#if this.isShowingElementCenterModal}} - + -

Centered on element.

-
- {{/if}} -
\ No newline at end of file + @language="hbs" + /> + + + <:default as |D|> + {{#if D.isModalOpen}} + +

Centered on element.

+
+ {{/if}} + + \ No newline at end of file diff --git a/tests/dummy/app/utils/code-snippets/animatable.js b/tests/dummy/app/utils/code-snippets/animatable.js index 9f697fce..405d0df7 100644 --- a/tests/dummy/app/utils/code-snippets/animatable.js +++ b/tests/dummy/app/utils/code-snippets/animatable.js @@ -15,7 +15,7 @@ export const codeSnippets = { );`, 'basic-modal-dialog-animatable-hbs': `Basic

`, 'translucent-modal-dialog-animatable-hbs': `With Translucent Overlay

`, 'without-overlay-modal-dialog-animatable-hbs': ` @@ -56,16 +56,14 @@ export const codeSnippets = {

Without Overlay

`, 'without-overlay-click-outside-to-close-modal-dialog-animatable-hbs': `Without Overlay - Click Outside to Close

`, 'custom-styles-modal-dialog-animatable-hbs': `Custom Styles

@@ -139,14 +135,14 @@ export default class MyCoolModalDialog extends ModalDialogComponent { }`, 'subclass-modal-dialog-animatable-hbs': `

Stop! Modal Time!

Via Subclass

diff --git a/tests/dummy/app/utils/code-snippets/index.js b/tests/dummy/app/utils/code-snippets/index.js index e6dacfd1..c0b51c25 100644 --- a/tests/dummy/app/utils/code-snippets/index.js +++ b/tests/dummy/app/utils/code-snippets/index.js @@ -1,90 +1,78 @@ export const codeSnippets = { 'basic-modal-dialog-hbs': `

Stop! Modal Time!

Basic

`, 'translucent-modal-dialog-hbs': `

Stop! Modal Time!

With Translucent Overlay

`, 'translucent-modal-dialog-with-callback-hbs': `

Stop! Modal Time!

Translucent Overlay with Callback

`, 'modal-dialog-without-overlay-hbs': `

Stop! Modal Time!

Without Overlay

`, 'translucent-modal-dialog-sibling-hbs': `

Stop! Modal Time!

With Translucent Overlay as Sibling

`, 'custom-styles-modal-dialog-hbs': `Stop! Modal Time!

Custom Styles

@@ -131,7 +116,7 @@ export const codeSnippets = { }`, 'target-selector-modal-dialog-hbs': `Attachment: {{this.exampleAttachment}}

`, 'target-element-modal-dialog-hbs': `Attachment: {{this.exampleAttachment}}

@@ -182,21 +167,21 @@ export default class MyCoolModalDialog extends ModalDialogComponent {

Via Subclass

`, 'subclass-modal-dialog-hbs': `

Stop! Modal Time!

Via Subclass

@@ -208,21 +193,21 @@ export default class MyCoolModalDialog extends ModalDialogComponent { }`, 'subclass-modal-dialog-2-hbs': `

Stop! Modal Time!

Via Subclass

`, 'in-place-modal-dialog-hbs': `Stop! Modal Time!

In Place

@@ -249,7 +234,7 @@ export default class MyCoolModalDialog extends ModalDialogComponent { }`, 'in-place-modal-dialog-2-hbs': `Stop! Modal Time!

In Place

`, 'centered-scrolling-modal-dialog-hbs': ` Close @@ -325,10 +310,7 @@ export default class MyCoolModalDialog extends ModalDialogComponent { 'element-centered-modal-dialog-hbs': `Stop! Modal Time!

Custom Styles

@@ -90,7 +87,7 @@ this.transition( }`, 'target-selector-modal-dialog-liquid-tether-hbs': `Attachment: {{this.exampleAttachment}}

`, 'target-element-modal-dialog-liquid-tether-hbs': `Attachment: {{this.exampleAttachment}}

`, 'element-centered-modal-dialog-liquid-tether-hbs': `Stop! Modal Time!

Custom Styles

@@ -50,7 +47,7 @@ export const codeSnippets = { }`, 'target-selector-modal-dialog-tethered-hbs': `Attachment: {{this.exampleAttachment}}

`, 'target-element-modal-dialog-tethered-hbs': `Attachment: {{this.exampleAttachment}}

@@ -90,10 +87,7 @@ export const codeSnippets = { 'element-centered-modal-dialog-tethered-hbs': `

Centered on element.

`,