Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed {{action}} helper from docs-app #410

Merged
merged 7 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
114 changes: 0 additions & 114 deletions tests/acceptance/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Comment on lines -31 to -33
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the assertions with my-data-test, because they, in essence, test if Ember's splattributes work.

'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',
);
},
});
});

Expand All @@ -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',
);
},
});
});

Expand All @@ -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',
);
},
});
});

Expand All @@ -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',
);
},
});
});

Expand All @@ -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',
);
},
});
});

Expand Down Expand Up @@ -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',
);
},
});
});

Expand All @@ -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',
);
},
});
});
Expand All @@ -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',
);
},
});
});

Expand All @@ -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',
);
},
});
});
Expand All @@ -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',
);
},
});
});
Expand All @@ -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',
Expand Down Expand Up @@ -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);
});
});
17 changes: 0 additions & 17 deletions tests/dummy/app/components/component-that-uses-modal-dialog.hbs

This file was deleted.

16 changes: 0 additions & 16 deletions tests/dummy/app/components/component-that-uses-modal-dialog.js

This file was deleted.

34 changes: 34 additions & 0 deletions tests/dummy/app/components/demo-modal.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div class="example" id={{@id}}>
<h2>{{@title}}</h2>

<div>
{{yield
(hash
OpenButton=(component
"demo-modal/button"
label="Open"
onClick=this.openModal
)
)
to="menu"
}}
</div>

<div>
{{yield to="code"}}
</div>

<div>
{{yield
(hash
CloseButton=(component
"demo-modal/button"
label="Close"
onClick=this.closeModal
)
closeModal=this.closeModal
isModalOpen=this.isModalOpen
)
}}
</div>
</div>
19 changes: 19 additions & 0 deletions tests/dummy/app/components/demo-modal.js
Original file line number Diff line number Diff line change
@@ -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?.();
}
}
8 changes: 8 additions & 0 deletions tests/dummy/app/components/demo-modal/button.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<button
data-test-button={{@label}}
type="button"
{{on "click" @onClick}}
...attributes
>
{{@label}}
</button>
5 changes: 5 additions & 0 deletions tests/dummy/app/components/demo-modal/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import templateOnlyComponent from '@ember/component/template-only';

const DemoModalButton = templateOnlyComponent();

export default DemoModalButton;
Loading
Loading