Skip to content

Commit

Permalink
Add new test cases for dataviewjs
Browse files Browse the repository at this point in the history
  • Loading branch information
oleeskild committed Oct 5, 2023
1 parent 537d597 commit 5b2d44b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ dg-publish: true
---



`=this.file.name`

`= [[PD0 - note with summary]].summary`
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
dg-publish: true
---

`$=2+1`
`$=dv.pages().length + dv.pages().length`
`$=dv.paragraph("A paragraph")`
20 changes: 20 additions & 0 deletions src/dg-testVault/P Plugins/PD Dataview/PD4 DataviewJs queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
dg-publish: true
---
```dataviewjs
dv.header(2, 'Header 2');
let pg = dv.current().file.name;
dv.paragraph(pg)
```

```dataviewjs
dv.table(["mtime", "link"],
dv.pages()
.where(p => p.file.name.includes("Custom"))
.map(p => [
p.file.mtime,
p.file.link
])
)
```

34 changes: 33 additions & 1 deletion src/test/snapshot/snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ I'm a list of all files in this folder:
- [[P Plugins/PD Dataview/PD0 - note with summary\|PD0 - note with summary]]
- [[P Plugins/PD Dataview/PD1 Dataview\|PD1 Dataview]]
- [[P Plugins/PD Dataview/PD2 Inline queries\|PD2 Inline queries]]
- [[P Plugins/PD Dataview/PD3 Inline JS queries\|PD3 Inline JS queries]]
- [[P Plugins/PD Dataview/PD4 DataviewJs queries\|PD4 DataviewJs queries]]
- [[P Plugins/PE Excalidraw/PE1 Transcluded excalidraw\|PE1 Transcluded excalidraw]]
- [[P Plugins/PE Excalidraw/PE2 excalidraw with image\|PE2 excalidraw with image]]

Expand All @@ -622,10 +624,40 @@ P Plugins/PD Dataview/PD2 Inline queries.md




PD2 Inline queries

this note is about foo

/img/user/A Assets/travolta.png
,/img/user/A Assets/unused_image.png
,/img/user/A Assets/travolta.webp
==========
P Plugins/PD Dataview/PD3 Inline JS queries.md
==========
---
{"dg-publish":true,"permalink":"/p-plugins/pd-dataview/pd-3-inline-js-queries/"}
---


3
92
<p><span>A paragraph</span></p>

/img/user/A Assets/travolta.png
,/img/user/A Assets/unused_image.png
,/img/user/A Assets/travolta.webp
==========
P Plugins/PD Dataview/PD4 DataviewJs queries.md
==========
---
{"dg-publish":true,"permalink":"/p-plugins/pd-dataview/pd-4-dataview-js-queries/"}
---

<h2><span>Header 2</span></h2><p><span>PD4 DataviewJs queries</span></p>

<div><table class="dataview table-view-table"><thead class="table-view-thead"><tr class="table-view-tr-header"><th class="table-view-th"><span>mtime</span><span class="dataview small-text">4</span></th><th class="table-view-th"><span>link</span></th></tr></thead><tbody class="table-view-tbody"><tr><td>9:33 pm - September 20, 2023</td><td><span><a data-tooltip-position="top" aria-label="005 Custom filters.md" data-href="005 Custom filters.md" href="005 Custom filters.md" class="internal-link" target="_blank" rel="noopener">005 Custom filters</a></span></td></tr><tr><td>9:20 pm - September 25, 2023</td><td><span><a data-tooltip-position="top" aria-label="006 Custom title.md" data-href="006 Custom title.md" href="006 Custom title.md" class="internal-link" target="_blank" rel="noopener">006 Custom title</a></span></td></tr><tr><td>9:20 pm - September 25, 2023</td><td><span><a data-tooltip-position="top" aria-label="007 Custom permalink.md" data-href="007 Custom permalink.md" href="007 Custom permalink.md" class="internal-link" target="_blank" rel="noopener">007 Custom permalink</a></span></td></tr><tr><td>9:27 pm - October 01, 2023</td><td><span><a data-tooltip-position="top" aria-label="011 Custom updatedAt.md" data-href="011 Custom updatedAt.md" href="011 Custom updatedAt.md" class="internal-link" target="_blank" rel="noopener">011 Custom updatedAt</a></span></td></tr></tbody></table></div>


/img/user/A Assets/travolta.png
,/img/user/A Assets/unused_image.png
,/img/user/A Assets/travolta.webp
Expand Down

0 comments on commit 5b2d44b

Please sign in to comment.