Commit 2bacfb95 authored by julien's avatar julien

updated test to handle target-text with no argument

parent d5b94dde
......@@ -44,28 +44,34 @@
a::after {
color: blueviolet;
display: block;
margin-bottom: 3em;
}
nav a[href]::after {
content: target-text(attr(href url), content);
nav li:nth-of-type(1) a[href]::after {
content: target-text(attr(href url));
}
nav li:nth-of-type(2) a[href]::after {
content: target-text(attr(href url), first-letter);
content: target-text(attr(href url), content);
}
nav li:nth-of-type(3) a[href]::after {
content: target-text(attr(href url), before);
content: target-text(attr(href url), first-letter);
}
nav li:nth-of-type(4) a[href]::after {
content: target-text(attr(href url), before);
}
nav li:nth-of-type(5) a[href]::after {
content: target-text(attr(href url), after);
}
/* before and after */
#chap3::before {
content: "This is inside the before"
content: " This is inside the before: ";
color: orange;
}
#chap4::after {
content: "This is inside the after"
content: ": This is inside the after ";
color: orange;
}
</style>
......@@ -100,6 +106,7 @@
<nav>
<h1>Table of contents</h1>
<ul>
<li><a href="#chap0">target-text: </a></li>
<li><a href="#chap1">target-text content: </a></li>
<li><a href="#chap2">target-text first-letter: </a></li>
<li><a href="#chap3">target-text:: before: </a></li>
......@@ -107,6 +114,9 @@
</ul>
</nav>
</section>
<section>
<h1 id="chap0">Lorem ipsum dolor sit amet</h1>
</section>
<section>
<h1 id="chap1">Lorem ipsum dolor sit amet</h1>
......
......@@ -19,19 +19,24 @@ describe('target-text', async () => {
expect(text).toContain("Lorem ipsum dolor sit amet");
})
it('Table of content should include first-letter of the chapter title', async () => {
it('Table of content should include chapter titles', async () => {
let text = await page.$eval("nav li:nth-of-type(2) a" , (r) => window.getComputedStyle(r, '::after').content);
expect(text).toContain("Lorem ipsum dolor sit amet");
})
it('Table of content should include first-letter of the chapter title', async () => {
let text = await page.$eval("nav li:nth-of-type(3) a" , (r) => window.getComputedStyle(r, '::after').content);
expect(text).toContain("P");
})
it('Table of content should include the content of the before pseudo element', async () => {
let text = await page.$eval("nav li:nth-of-type(3) a" , (r) => window.getComputedStyle(r, '::after').content);
expect(text).toContain("This is inside the before");
let text = await page.$eval("nav li:nth-of-type(4) a" , (r) => window.getComputedStyle(r, '::after').content);
expect(text).toContain("This is inside the before: ");
})
it('Table of content should include the content of the before pseudo element', async () => {
let text = await page.$eval("nav li:nth-of-type(4) a" , (r) => window.getComputedStyle(r, '::after').content);
expect(text).toContain("This is inside the after");
let text = await page.$eval("nav li:nth-of-type(5) a" , (r) => window.getComputedStyle(r, '::after').content);
expect(text).toContain(": This is inside the after");
})
if (!DEBUG) {
it('should create a pdf', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment