Skip to content

Commit 60634bd

Browse files
committed
chore: dtrack config, docs, tests
1 parent 238eb11 commit 60634bd

11 files changed

Lines changed: 455 additions & 651 deletions

File tree

.github/workflows/dtrack-trivy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
- .github/workflows/dtrack-trivy.yml
66
- 'composer.json'
77
- 'composer.lock'
8+
- 'yarn.lock'
89
pull_request:
910
paths:
1011
- .github/workflows/dtrack-trivy.yml
1112
- 'composer.json'
1213
- 'composer.lock'
14+
- 'yarn.lock'
1315
workflow_dispatch:
1416

1517
permissions:

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const config = {
77
tabWidth: 4,
88
semi: false,
99
singleQuote: true,
10-
plugins: ["@ttskch/prettier-plugin-tailwindcss-anywhere", "prettier-plugin-tailwindcss", "@zackad/prettier-plugin-twig-melody"],
10+
plugins: ["@zackad/prettier-plugin-twig"],
1111
};
1212

1313
module.exports = config;

clover.xml

Lines changed: 69 additions & 69 deletions
Large diffs are not rendered by default.

docs/introduction.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ No matter which frontend technologies you use in a project ([Twig](https://twig.
2424
In short, I advocate for using standardized HTML5 markup, in order to having to write less of it and instead generate it. Descriptive, easy to read languages like YAML can help composing compositions of HTML5 elements, such as a search form.
2525
:::
2626

27+
::: code-group
28+
29+
```php [PHP]
30+
use ExtendedHTMLDocument\HTML\Elements\Form;
31+
Form::create();
32+
```
33+
34+
```twig [Twig]
35+
form.render()
36+
```
37+
:::
38+
39+
2740
## Where to go next?
2841
- [Features Overview](./features)
2942
- [Getting Started](./getting-started)

docs/phpmd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,4 @@ Issues detected: 76
137137

138138
Issues detected: 8
139139

140-
Tue Apr 1 09:02:10 CEST 2025
140+
Sat Jul 12 11:04:46 AM CEST 2025

docs/usage-examples.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ tbd add a gif
1212
This part is currently work in progress. The information below might be outdated, incomplete or incorrect.
1313
:::
1414

15+
1516
### Creation via `create()` method
1617

1718
```php{4}

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
{
22
"devDependencies": {
3-
"@ttskch/prettier-plugin-tailwindcss-anywhere": "^0.1.0",
3+
"@algolia/client-search": "^5.23.0",
4+
"@zackad/prettier-plugin-twig": "^0.16.0",
45
"prettier": "^3.5.3",
5-
"prettier-plugin-tailwindcss": "^0.6.11",
6-
"prettier-plugin-twig": "^1.0.1",
6+
"search-insights": "^2.17.3",
77
"vitepress": "^1.6.3"
88
},
99
"license": "MIT",
1010
"scripts": {
1111
"docs:dev": "vitepress dev docs",
1212
"docs:build": "vitepress build docs",
1313
"docs:preview": "vitepress preview docs"
14-
},
15-
"dependencies": {
16-
"@zackad/prettier-plugin-twig-melody": "^0.6.0"
1714
}
1815
}

src/Interface/DOMNodeListDelegatorInterface.php

Whitespace-only changes.

tests/Delegator/DOMNodeDelegatorTest.php

Whitespace-only changes.

tests/Delegator/HTMLElementDelegatorTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
$this->delegator = Anchor::create($this->document);
1919
});
2020

21+
test('teste irgendetwas', function () {
22+
expect('irgendetwas')->toEqual('irgendetwas anderes');
23+
});
24+
25+
2126
test('constructor', function () {
2227
expect($this->delegator)->toBeInstanceOf(HTMLElementDelegator::class);
2328
});
@@ -357,3 +362,46 @@
357362
expect($this->delegator->renderer)
358363
->toBe($renderer);
359364
});
365+
test('appendChild should successfully append a child element', function () {
366+
$document = HTMLDocumentDelegator::createEmpty();
367+
$parent = HTML::create($document);
368+
$child = Body::create($document);
369+
370+
$result = $parent->appendChild($child);
371+
372+
expect($result)
373+
->toBe($parent); // Test method chaining
374+
expect($parent->delegated->firstChild)
375+
->toBe($child->delegated);
376+
});
377+
378+
test('appendChild should reject child from different document', function () {
379+
$document1 = HTMLDocumentDelegator::createEmpty();
380+
$document2 = HTMLDocumentDelegator::createEmpty();
381+
382+
$parent = HTML::create($document1);
383+
$child = Body::create($document2);
384+
385+
expect(fn () => $parent->appendChild($child))
386+
->toThrow(
387+
InvalidArgumentException::class,
388+
'The child element must belong to the same document as the parent element.'
389+
);
390+
});
391+
392+
test('appendChild should handle chained calls', function () {
393+
$document = HTMLDocumentDelegator::createEmpty();
394+
$parent = HTML::create($document);
395+
$child1 = Body::create($document);
396+
$child2 = Head::create($document);
397+
398+
$parent->appendChild($child1)
399+
->appendChild($child2);
400+
401+
expect($parent->delegated->childNodes->length)
402+
->toBe(2);
403+
expect($parent->delegated->firstChild)
404+
->toBe($child1->delegated);
405+
expect($parent->delegated->lastChild)
406+
->toBe($child2->delegated);
407+
});

0 commit comments

Comments
 (0)