fix(curriculum): few small changes in test 7 and 8 (#53316)

Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com>
This commit is contained in:
Anikait Prasar
2024-01-24 20:53:31 +05:30
committed by GitHub
parent 756a7f77fe
commit ec4d58c05a
2 changed files with 19 additions and 9 deletions

View File

@@ -7,9 +7,15 @@ dashedName: step-7
# --description--
Add a `click` event listener to the `closeTaskFormBtn` variable, then use the `showModal()` method on your `confirmCloseDialog` variable. This will display a modal with the `Discard` and `Cancel` buttons.
The HTML `dialog` element has a `showModal()` method that can be used to display a modal dialog box on a web page.
`showModal()` is a method associated with the HTML `dialog` element. It is used to display a modal dialog box on a web page.
```js
dialogElement.showModal();
```
Add an event listener to the `closeTaskFormBtn` variable and pass in a `click` event for the first argument and a callback function for the second argument.
For the callback function, call the `showModal()` method on the `confirmCloseDialog` element. This will display a modal with the `Discard` and `Cancel` buttons.
# --hints--
@@ -25,10 +31,10 @@ Your event listener should listen for a `click` event.
assert.match(code, /closeTaskFormBtn\.addEventListener\(('|"|`)click\1/)
```
Your event listener should use arrow syntax to set the `showModal()` method on `confirmCloseDialog`.
Your event listener's callback function should call the `showModal()` method on the `confirmCloseDialog` element.
```js
assert.match(code, /closeTaskFormBtn\.addEventListener\(('|"|`)click\1,\s*\(.*\)\s*=>\s*{?\s*confirmCloseDialog\.showModal\(\);?\s*}?\s*\);?/)
assert.match(code, /closeTaskFormBtn\.addEventListener\(('|"|`)click\1,\s*\(.*\)\s*=>\s*(\{\s*confirmCloseDialog\.showModal\(\s*\)\s*;?\s*\}|confirmCloseDialog\.showModal\(\s*\))\s*\)\s*;?/)
```
# --seed--

View File

@@ -7,11 +7,15 @@ dashedName: step-8
# --description--
If the user clicks the `Cancel` button, you want to cancel the process (close the modal showing the two buttons) so the user can continue editing.
If the user clicks the `Cancel` button, you want to cancel the process and close the modal so the user can continue editing. The HTML `dialog` element has a `close()` method that can be used to close a modal dialog box on a web page.
Add a `click` event listener to the `cancelBtn` element, then use the `close()` method on the `confirmCloseDialog` variable.
```js
dialogElement.close();
```
`close()` is a method of the window object you can use to close the current window, or a modal you create with the `dialog` element.
Add an event listener to the `cancelBtn` element and pass in a `click` event for the first argument and a callback function for the second argument.
For the callback function, call the `close()` method on the `confirmCloseDialog` element.
# --hints--
@@ -27,10 +31,10 @@ Your event listener should listen for a `click` event.
assert.match(code, /cancelBtn\.addEventListener\(('|"|`)click\1/)
```
Your event listener should use arrow syntax to set the `close()` method on `confirmCloseDialog`. Don't use curly braces.
Your event listener's callback function should call the `close()` method on `confirmCloseDialog` element.
```js
assert.match(code, /cancelBtn\.addEventListener\(('|"|`)click\1\,\s*\(\)\s*\s*=>\s*confirmCloseDialog\.close\(\)\s*\);?/)
assert.match(code, /cancelBtn\.addEventListener\(('|"|`)click\1\s*\,\s*\(\s*\)\s*=>\s*(\{\s*confirmCloseDialog\.close\(\s*\)\s*;?\s*\}|confirmCloseDialog\.close\(\s*\))\s*\)\s*;?/)
```
# --seed--