Skip to content

Commit

Permalink
0.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Feb 29, 2024
1 parent f7428fa commit b0569e3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
3 changes: 2 additions & 1 deletion demo/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
}
</script>
<script type=module>
import '../behivior.js'
import 'be-enhanced/beEnhanced.js';
import '../be-value-added.js';
</script>
<script type=module>
console.log('iah1');
Expand Down
28 changes: 28 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// playwright.config.ts
import { PlaywrightTestConfig, devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run serve',
url: 'http://localhost:3030/',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
use: {
baseURL: 'http://localhost:3030/',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
};
export default config;
18 changes: 11 additions & 7 deletions tests/Test1.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
</head>
<body>
<time id=time></time>
<!-- <data id=data></data>
<meta id=meta>
<link id=link> -->
<div id=target></div>

<script type=importmap>
{
Expand All @@ -24,14 +22,20 @@
}
</script>
<script type=module>
import '../behivior.js'
import 'be-enhanced/beEnhanced.js';
import '../be-value-added.js'
</script>
<script type=module>
function validate(){
if(time.textContent = (new Date()).toLocaleDateString()){
target.setAttribute('mark', 'good');
}
}
await customElements.whenDefined('be-enhanced');
time.beEnhanced.by.beValueAdded.value = new Date();
// data.beEnhanced.by.beValueAdded.value = 13456789;
// meta.beEnhanced.by.beValueAdded.value = 'hello';
// link.beEnhanced.by.beValueAdded.value = true;
setTimeout(() => {
validate();
}, 100);
</script>
</body>
</html>
8 changes: 8 additions & 0 deletions tests/test1.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test';
test('test1', async ({ page }) => {
await page.goto('./tests/Test1.html');
// wait for 1 second
await page.waitForTimeout(2000);
const editor = page.locator('#target');
await expect(editor).toHaveAttribute('mark', 'good');
});

0 comments on commit b0569e3

Please sign in to comment.