mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Add unusedtitle macro tests - should have full code covery (#7939)
* add unusedtitle macro tests - should have full code covery * remove numbering from tests
This commit is contained in:
parent
b6eab1afd6
commit
b4d7e34a5a
@ -0,0 +1,27 @@
|
||||
title: Macros/unusedtitle/basic-draft-exists
|
||||
description: test <<unusedtitle>> with basic macro parameters but they are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Draft of 'test'
|
||||
draft.of: test
|
||||
draft.title: test
|
||||
|
||||
+
|
||||
title: Draft of 'asdf 0'
|
||||
draft.of: asdf 0
|
||||
draft.title: asdf 0
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<!-- hanled in wiki.js -->
|
||||
<<unusedtitle baseName:"test">>
|
||||
|
||||
<!-- handled in unusedtitle.js -->
|
||||
<<unusedtitle baseName:"asdf" separator:" " template:"$basename$$separator$$count:1$">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>test 1</p><p>asdf 1</p>
|
@ -0,0 +1,23 @@
|
||||
title: Macros/unusedtitle/basic-params-empty-tiddler-exists
|
||||
description: test <<unusedtitle>> with basic macro parameters but they are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: New Tiddler
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<!-- hanled in wiki.js -->
|
||||
<<unusedtitle separator:"">>
|
||||
|
||||
<!-- handled in unusedtitle.js -->
|
||||
<<unusedtitle baseName:"">>
|
||||
|
||||
<!-- handled in wiki.js -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler 1</p><p>New Tiddler 1</p><p>New Tiddler 1</p>
|
@ -0,0 +1,20 @@
|
||||
title: Macros/unusedtitle/basic-params-empty
|
||||
description: test <<unusedtitle>> with basic macro parameters but they are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<!-- hanled in wiki.js -->
|
||||
<<unusedtitle separator:"">>
|
||||
|
||||
<!-- handled in unusedtitle.js -->
|
||||
<<unusedtitle baseName:"">>
|
||||
|
||||
<!-- handled in wiki.js -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>New Tiddler</p><p>New Tiddler</p>
|
@ -0,0 +1,28 @@
|
||||
title: Macros/unusedtitle/basic-params-tiddlers-exist
|
||||
description: test <<unusedtitle>> with basic macro parameters, where new-name tiddlers already exist
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: New Tiddler
|
||||
|
||||
+
|
||||
title: anotherBase
|
||||
|
||||
+
|
||||
title: About
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<<unusedtitle>>
|
||||
|
||||
<<unusedtitle separator:"-">>
|
||||
|
||||
<<unusedtitle baseName:"anotherBase">>
|
||||
|
||||
<<unusedtitle baseName:"About" separator:"-">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler 1</p><p>New Tiddler-1</p><p>anotherBase 1</p><p>About-1</p>
|
@ -0,0 +1,20 @@
|
||||
title: Macros/unusedtitle/basic-params
|
||||
description: test <<unusedtitle>> with basic macro parameters
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<<unusedtitle>>
|
||||
|
||||
<!-- EDGECASE: separator is ignored if tiddler title does not exist -->
|
||||
<<unusedtitle separator:"-">>
|
||||
|
||||
<<unusedtitle baseName:"anotherBase">>
|
||||
|
||||
<<unusedtitle baseName:"About" separator:"-">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>New Tiddler</p><p>anotherBase</p><p>About</p>
|
@ -0,0 +1,50 @@
|
||||
title: Macros/unusedtitle/template-empty-params-tiddler-exist
|
||||
description: test <<unusedtitle>> with templates where parameters are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: New Tiddler
|
||||
|
||||
+
|
||||
title: xxx
|
||||
|
||||
+
|
||||
title: 00-New Tiddler
|
||||
|
||||
+
|
||||
title: 0000 asdf
|
||||
|
||||
+
|
||||
title: 0001 asdf
|
||||
|
||||
+
|
||||
title: 0000 abc
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<!-- empty template - no template handling at all -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
<!--
|
||||
uses basename AND separator if tiddler exists
|
||||
because it uses default naming build rules - no template handling
|
||||
-->
|
||||
<<unusedtitle template:"" separator:"-y-" baseName:"xxx">>
|
||||
|
||||
<<unusedtitle baseName:"" template:"$count:2$-$basename$">>
|
||||
|
||||
<!--
|
||||
EDGECASE: if separator is empty it will be initialized with a single space " "
|
||||
to have the same rules for templates and default title creation
|
||||
-->
|
||||
<<unusedtitle baseName:"asdf" separator:"" template:"$count:4$$separator$$basename$">>
|
||||
|
||||
<!-- separator = " " -->
|
||||
<<unusedtitle baseName:"abc" separator:" " template:"$count:4$$separator$$basename$">>
|
||||
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler 1</p><p>xxx-y-1</p><p>01-New Tiddler</p><p>0002 asdf</p><p>0001 abc</p>
|
@ -0,0 +1,24 @@
|
||||
title: Macros/unusedtitle/template-empty-params
|
||||
description: test <<unusedtitle>> with templates where parameters are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<!-- empty template -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
<!--
|
||||
uses basename but ignores separator,
|
||||
because it uses default naming build rules -- no template handling is active
|
||||
-->
|
||||
<<unusedtitle template:"" separator:"-x-" baseName:"xxx">>
|
||||
|
||||
<<unusedtitle baseName:"" template:"$count:2$-$basename$">>
|
||||
|
||||
<<unusedtitle baseName:"asdf" separator:"" template:"$count:4$$separator$$basename$">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>xxx</p><p>00-New Tiddler</p><p>0000 asdf</p>
|
@ -0,0 +1,28 @@
|
||||
title: Macros/unusedtitle/template
|
||||
description: test <<unusedtitle>> with templates
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<!-- empty template - standard rules are used -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
<<unusedtitle template:"count-missing">>
|
||||
|
||||
<<unusedtitle template:"$count:2$-new">>
|
||||
|
||||
<!-- template is handled using $tw.utils.formatTitleString -->
|
||||
<<unusedtitle baseName:"base" template:"$count:2$-$basename$">>
|
||||
|
||||
<<unusedtitle baseName:"" template:"$count:2$-$basename$">>
|
||||
|
||||
<!-- UPPERCASES are intentional in template strings. They should be case-insensistive -->
|
||||
<<unusedtitle baseName:"asdf" separator:"-" template:"$coUNT:2$$sepaRATor$$baseName$">>
|
||||
|
||||
<<unusedtitle baseName:"asdf" separator:"" template:"$count:2$$separator$$basename$">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>count-missing</p><p>00-new</p><p>00-base</p><p>00-New Tiddler</p><p>00-asdf</p><p>00 asdf</p>
|
Loading…
Reference in New Issue
Block a user