Browse Source

public issues

content-update
miguel 2 years ago
parent
commit
a622a6dc92
  1. 17
      dom/pick-and-click_test.js
  2. 2
      js/tests/get-json_test.js
  3. 4
      subjects/pronoun/README.md

17
dom/pick-and-click_test.js

@ -77,16 +77,17 @@ tests.push(async ({ page, eq, bodyBgRgb, random }) => {
tests.push(async ({ page, eq, bodyBgRgb, random }) => { tests.push(async ({ page, eq, bodyBgRgb, random }) => {
// check that the hsl value is copied in the clipboard on click // check that the hsl value is copied in the clipboard on click
for (const move of generateCoords(random)) { for (const move of generateCoords(random)) {
await page.mouse.click(...move) await page.evaluate(() => {
const clipboard = await page.evaluate(() => {
// mock clipboard
let clipboardText = null let clipboardText = null
window["navigator"]["clipboard"] = { window.navigator.clipboard.readText = () =>
writeText: (text) => new Promise((resolve) => (clipboardText = text)), new Promise((resolve) => resolve(clipboardText))
readText: () => new Promise((resolve) => resolve(clipboardText)), window.navigator.clipboard.writeText = (text) =>
} new Promise(() => (clipboardText = text))
return navigator.clipboard.readText()
}) })
await page.mouse.click(...move)
const clipboard = await page.evaluate(() =>
window.navigator.clipboard.readText()
)
const hslValue = await page.$eval(".hsl", (hsl) => hsl.textContent) const hslValue = await page.$eval(".hsl", (hsl) => hsl.textContent)
eq(hslValue, clipboard) eq(hslValue, clipboard)
} }

2
js/tests/get-json_test.js

@ -14,7 +14,7 @@ t(async ({ eq }) => {
// check url parsing // check url parsing
let url let url
fetch = async (arg) => fakeFetch({ url: (url = arg) }) fetch = async (arg) => fakeFetch({ url: (url = arg) })
const pending = getJSON('/test', { query: 'hello world', b: 5 }) const pending = await getJSON('/test', { query: 'hello world', b: 5 })
return eq(url, '/test?query=hello+world&b=5') return eq(url, '/test?query=hello+world&b=5')
}) })

4
subjects/pronoun/README.md

@ -3,8 +3,8 @@
### Instructions ### Instructions
Create a function called `pronoun` that has a string as parameter. This function returns an object Create a function called `pronoun` that has a string as parameter. This function returns an object
that will have all the pronouns, present in the string, as keys. Each key will have a sub object with the that will have all the personal pronouns, present in the string, as keys. Each key will have a sub object with the
first word after each of the pronouns found in the string. first word after each of the personal pronouns found in the string.
Also, a property `count` must be added, to the sub object, with the amount of occurrences of the pronoun. Also, a property `count` must be added, to the sub object, with the amount of occurrences of the pronoun.
#### Example #### Example

Loading…
Cancel
Save