Skip to content

Commit

Permalink
Remove code
Browse files Browse the repository at this point in the history
  • Loading branch information
zfir committed Jul 16, 2024
1 parent a700279 commit a9dd79a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 47 deletions.
15 changes: 1 addition & 14 deletions app/components/input-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
{{!-- app/components/input-modal.hbs --}}
<div class="input-modal">
<div data-test-modal="" class="modal-content">
<button data-test-close-btn="" type="button" {{on "click" this.closeModal}}>X</button>
<label for="first-name">First Name</label>
<input id="first-name" type="text" value={{this.firstName}} {{on "input" this.updateFirstName}} />

<label for="last-name">Last Name</label>
<input id="last-name" type="text" value={{this.lastName}} {{on "input" this.updateLastName}} />

<label for="email">Email</label>
<input id="email" type="email" value={{this.email}} {{on "input" this.updateEmail}} />
<button data-test-save-btn="" type="button" {{on "click" this.save}}>Save</button>
</div>
</div>
{{!-- Write template here --}}
32 changes: 1 addition & 31 deletions app/components/input-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,5 @@ interface InputModalArgs {
}

export default class InputModalComponent extends Component<InputModalArgs> {
@tracked firstName = '';
@tracked lastName = '';
@tracked email = '';

@action
updateFirstName(event: Event) {
this.firstName = (event.target as HTMLInputElement).value;
}

@action
updateLastName(event: Event) {
this.lastName = (event.target as HTMLInputElement).value;
}

@action
updateEmail(event: Event) {
this.email = (event.target as HTMLInputElement).value;
}

@action
closeModal() {
if (this.args.closeModal) {
this.args.closeModal();
}
}

@action
save() {
alert('Data saved successfully!');
this.closeModal();
}
// Write controller here
}
3 changes: 1 addition & 2 deletions tests/integration/components/open-modal-button-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ module('Integration | Component | open-modal-button', function (hooks) {
setupRenderingTest(hooks);

test('it renders the open modal button', async function (assert) {
await render(hbs`<OpenModalButton />`);
assert.dom('button').hasText('Open Modal');
// Write the test here
});

test('it opens the modal when the button is clicked', async function (assert) {
Expand Down

0 comments on commit a9dd79a

Please sign in to comment.