mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): update test for lab currency converter (#66403)
This commit is contained in:
+20
@@ -147,6 +147,16 @@ Changing the value of the first `select` element should display the new converte
|
||||
```js
|
||||
const s = await __helpers.prepTestComponent(window.index.CurrencyConverter);
|
||||
|
||||
const inp = s.querySelector('input[type="number"]');
|
||||
assert.exists(inp);
|
||||
|
||||
await React.act(async () => {
|
||||
inp.value = 10;
|
||||
const ev = new Event("change", { bubbles: true, cancelable: false });
|
||||
inp[Object.keys(inp).find((k) => k.startsWith("__reactProps"))]
|
||||
.onChange({...ev, target: inp});
|
||||
});
|
||||
|
||||
const nonFormContentBefore = getInnerTextExcept(s, "input,select");
|
||||
const resultBefore = nonFormContentBefore.match(/(\d+\.\d{2})\s*([A-Z]{3})/);
|
||||
|
||||
@@ -172,6 +182,16 @@ Changing the value of the second `select` element should display the new convert
|
||||
```js
|
||||
const s = await __helpers.prepTestComponent(window.index.CurrencyConverter);
|
||||
|
||||
const inp = s.querySelector('input[type="number"]');
|
||||
assert.exists(inp);
|
||||
|
||||
await React.act(async () => {
|
||||
inp.value = 10;
|
||||
const ev = new Event("change", { bubbles: true, cancelable: false });
|
||||
inp[Object.keys(inp).find((k) => k.startsWith("__reactProps"))]
|
||||
.onChange({...ev, target: inp});
|
||||
});
|
||||
|
||||
const nonFormContentBefore = getInnerTextExcept(s, "input,select");
|
||||
const resultBefore = nonFormContentBefore.match(/(\d+\.\d{2})\s*([A-Z]{3})/);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user