From ec4d58c05a682ad6592b551faea0cef2be3198de Mon Sep 17 00:00:00 2001 From: Anikait Prasar <106008390+anikait-prasar@users.noreply.github.com> Date: Wed, 24 Jan 2024 20:53:31 +0530 Subject: [PATCH] fix(curriculum): few small changes in test 7 and 8 (#53316) Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com> --- .../64e4e7bbedb22d6939001ad3.md | 14 ++++++++++---- .../64e4eaaa9070a66aecbfe603.md | 14 +++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md index 65871e122e5..e1fcec44d64 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md @@ -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-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md index 58e4e3b0846..e930ac51c56 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md @@ -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--