Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Jul 8, 2024
1 parent 11a44d0 commit 39970bc
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 126 deletions.
5 changes: 5 additions & 0 deletions MoodStone/MoodStone.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ export class MoodStone extends HTMLElement {
super();
this.attachShadow({ mode: 'open' });
}
#invokeCount = 0;
get invokeCount() {
return this.#invokeCount;
}
howAmIFeelingAboutToday(self, e) {
this.#invokeCount++;
console.log({ self, e });
}
connectedCallback() {
Expand Down
6 changes: 6 additions & 0 deletions MoodStone/MoodStone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ export class MoodStone extends HTMLElement {
this.attachShadow({mode: 'open'});
}

#invokeCount = 0;
get invokeCount(){
return this.#invokeCount;
}

howAmIFeelingAboutToday(self: this, e: Event){
this.#invokeCount++;
console.log({self, e});
}

Expand Down
2 changes: 1 addition & 1 deletion be-invoking.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BeInvoking extends BE {
for (const remoteSpecifier of remoteSpecifiers) {
let remoteTarget = this.#cache.get(remoteSpecifier)?.deref();
if (remoteTarget === undefined) {
const remoteTarget = await find(enhancedElement, remoteSpecifier);
remoteTarget = await find(enhancedElement, remoteSpecifier);
if (!remoteTarget)
throw 404;
this.#cache.set(remoteSpecifier, new WeakRef(remoteTarget));
Expand Down
4 changes: 2 additions & 2 deletions be-invoking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class BeInvoking extends BE implements Actions {
const {remoteSpecifiers} = parsedStatement;
const {find} = await import('trans-render/dss/find.js');
for(const remoteSpecifier of remoteSpecifiers){
let remoteTarget = this.#cache.get(remoteSpecifier)?.deref();
let remoteTarget = this.#cache.get(remoteSpecifier)?.deref() as Element | undefined | null;
if(remoteTarget === undefined){
const remoteTarget = await find(enhancedElement, remoteSpecifier);
remoteTarget = await find(enhancedElement, remoteSpecifier);
if(!remoteTarget) throw 404;
this.#cache.set(remoteSpecifier, new WeakRef(remoteTarget));
}
Expand Down
142 changes: 71 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"update": "ncu -u && npm install"
},
"dependencies": {
"be-enhanced": "0.0.107",
"be-hive": "0.0.184",
"be-linked": "0.0.107",
"trans-render": "0.0.790"
"be-enhanced": "0.0.109",
"be-hive": "0.0.186",
"be-linked": "0.0.108",
"trans-render": "0.0.792"
},
"devDependencies": {
"may-it-serve": "0.0.7",
Expand Down
45 changes: 45 additions & 0 deletions tests/AllExamples.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Examples</title>
</head>
<body>
<mood-stone></mood-stone>
<div id=target></div>
<script type=importmap>
{
"imports": {
"be-enhanced/": "/node_modules/be-enhanced/",
"be-hive/": "/node_modules/be-hive/",
"be-linked/": "/node_modules/be-linked/",
"be-value-added/": "/node_modules/be-value-added/",
"mount-observer/": "/node_modules/mount-observer/",
"trans-render/": "/trans-render/"
}
}
</script>
<script type=module>
import '/MoodStone/MoodStone.js';
import '/🕹️.js';
</script>
<script>
function runTest(){
const ms = document.querySelector('mood-stone');
ms.shadowRoot.querySelector('input').dispatchEvent(new Event('input'));

setTimeout(() => {
if(ms.invokeCount === 1){
target.setAttribute('mark', 'good');
}
}, 100);

}
setTimeout(() => {
runTest();
}, 500);
</script>
</body>
</html>
45 changes: 0 additions & 45 deletions tests/Example1.html

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test1.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test, expect } from '@playwright/test';
test('test1', async ({ page }) => {
await page.goto('./tests/Example1.html');
await page.goto('./tests/AllExamples.html');
// wait for 1 second
await page.waitForTimeout(4000);
await page.waitForTimeout(1000);
const editor = page.locator('#target');
await expect(editor).toHaveAttribute('mark', 'good');
});
1 change: 0 additions & 1 deletion trans-render
Submodule trans-render deleted from 45d45d

0 comments on commit 39970bc

Please sign in to comment.