Skip to content

Commit f67afb3

Browse files
committed
test: add target attribute tests for listings
1 parent 3afebe1 commit f67afb3

7 files changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_site/
2+
.quarto/
3+
/.quarto/
4+
**/*.quarto_ipynb
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "Target Attribute Test"
6+
7+
format:
8+
html:
9+
theme: cosmo
10+
toc: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
listing:
3+
type: default
4+
contents: posts/*.qmd
5+
fields:
6+
- title
7+
_quarto:
8+
tests:
9+
html:
10+
ensureHtmlElements:
11+
-
12+
- "a[href$='post-with-target.html'][target='_blank']"
13+
- "a[href$='post-without-target.html']:not([target])"
14+
---
15+
16+
## Default listing with target attribute test
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
listing:
3+
type: grid
4+
contents: posts/*.qmd
5+
fields:
6+
- title
7+
_quarto:
8+
tests:
9+
html:
10+
ensureHtmlElements:
11+
-
12+
- "a[href$='post-with-target.html'][target='_blank']"
13+
- "a[href$='post-without-target.html']:not([target])"
14+
---
15+
16+
## Grid listing with target attribute test
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
listing:
3+
type: table
4+
contents: posts/*.qmd
5+
fields:
6+
- title
7+
table-hover: true
8+
_quarto:
9+
tests:
10+
html:
11+
ensureHtmlElements:
12+
-
13+
- "a[href$='post-with-target.html'][target='_blank']"
14+
- "a[href$='post-without-target.html']:not([target])"
15+
- "tr[onclick*='window.open']"
16+
---
17+
18+
## Table listing with target attribute test
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Post with target blank
3+
target: "_blank"
4+
---
5+
6+
This post should open in a new tab.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Post without target
3+
---
4+
5+
This post should open in the same tab.

0 commit comments

Comments
 (0)