From 735389d37c27affa4dcb49384cfe6b4b11e12109 Mon Sep 17 00:00:00 2001 From: didier amyot Date: Thu, 26 Oct 2023 08:23:09 -0400 Subject: [PATCH] added correction of homework 2 --- homework2/evaluation.mjs | 20 ++++++ homework2/index.html | 137 +++++++++++++++++++++++++++++++++++++++ homework2/script.js | 17 +++++ homework2/test.html | 32 +++++++++ 4 files changed, 206 insertions(+) create mode 100644 homework2/evaluation.mjs create mode 100644 homework2/index.html create mode 100644 homework2/script.js create mode 100644 homework2/test.html diff --git a/homework2/evaluation.mjs b/homework2/evaluation.mjs new file mode 100644 index 0000000..ed42629 --- /dev/null +++ b/homework2/evaluation.mjs @@ -0,0 +1,20 @@ +import mocha from "https://esm.sh/mocha@10.2.0" +import {assert} from "https://esm.sh/chai@4.3.10" +mocha.setup('bdd'); + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} +it('should run a bogus test', () => { + assert.equal(1 + 1, 2); +}); + +it("should copy text", async () => { + const expt = "toto"; + document.getElementById("input-1").value = expt; + document.getElementById("button-1").click(); + await sleep(1000); + assert.equal(expt, document.getElementById("result-box-1").innerText) + +}); +mocha.run(); \ No newline at end of file diff --git a/homework2/index.html b/homework2/index.html new file mode 100644 index 0000000..4f7e50c --- /dev/null +++ b/homework2/index.html @@ -0,0 +1,137 @@ + + + + + title + + + + +
+ +
+
+

#main-title

+
+
+ +
+
+
+
+
+ + +
+
+
+ #result-box-1 +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +
+
+
+
+ #result-box-2 +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +
+
+
+
+ #result-box-3 +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +
+
+
+
+ #result-box-4 +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+ + + + + + + + \ No newline at end of file diff --git a/homework2/script.js b/homework2/script.js new file mode 100644 index 0000000..38df685 --- /dev/null +++ b/homework2/script.js @@ -0,0 +1,17 @@ + + +function exo1b() { + let userInput = document.getElementById("input-1").value; + document.getElementById("result-box-1").innerText = userInput; +} + +document.getElementById("button-1").onclick = exo1b; + + +function exo1c() { + let userInput = document.getElementById("input-2").value; + + document.getElementById("result-box-3").innerText = getExo1c; +} + +document.getElementById("button-2").onclick = exo1b; \ No newline at end of file diff --git a/homework2/test.html b/homework2/test.html new file mode 100644 index 0000000..8e4727c --- /dev/null +++ b/homework2/test.html @@ -0,0 +1,32 @@ + + + + + Mocha Tests + + + + +
+ + + + + + + + + + + + + \ No newline at end of file