Skip to content

Commit 74bfab5

Browse files
author
Sanders Kleinfeld
committed
Regression tests to ensure url.in.parens handling works as expected for callout markers.
1 parent 1fba0b6 commit 74bfab5

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

htmlbook-xsl/xspec/chunk.xspec

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,32 @@
429429

430430
</x:scenario>
431431

432+
<x:scenario label="If callout-type 'stealth XREF' 'a' elements are matched">
433+
<x:context select="(//h:a[@class='co'])[1]">
434+
<pre data-type="programlisting" data-code-language="json"><?db-font-size 65%?>{
435+
"context_is_admin": [["role:admin"]],
436+
"admin_or_owner": [["is_admin:True"], ["project_id:%(project_id)s"]], <a class="co" id="co_ch9-co-1" href="#callout_ch9-co-1"><img src="/usr/local/app/git_tmp/c3c6787bcdd5a68b82f8e9e0a5dd141c/doc/openstack-ops/callouts/1.png" alt="1"/></a>
437+
...
438+
</pre>
439+
</x:context>
440+
441+
<x:scenario label="with url.in.parens disabled (callout stealth XREF; XREF with no data-type)">
442+
<x:context>
443+
<x:param name="url.in.parens" select="0"/>
444+
</x:context>
445+
446+
<x:expect label="No URL should be generated in parentheses after the 'a'" test="not(exists(//h:span[@class='print_url_in_parens']))"/>
447+
</x:scenario>
448+
449+
<x:scenario label="with url.in.parens enabled (callout stealth XREF; XREF with no data-type)">
450+
<x:context>
451+
<x:param name="url.in.parens" select="1"/>
452+
</x:context>
453+
454+
<x:expect label="No URL should be generated in parentheses after the 'a'" test="not(exists(//h:span[@class='print_url_in_parens']))"/>
455+
</x:scenario>
456+
</x:scenario>
457+
432458
<x:pending>
433459
<!-- Make sure there are some href tests with XREFs that are intra-chunk -->
434460
<!-- Possible to get this block working within XSpec? Currently getting the right results when

htmlbook-xsl/xspec/xrefgen.xspec

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,32 @@
827827

828828
</x:scenario>
829829

830+
<x:scenario label="If callout-type 'stealth XREF' 'a' elements are matched">
831+
<x:context select="(//h:a[@class='co'])[1]">
832+
<pre data-type="programlisting" data-code-language="json"><?db-font-size 65%?>{
833+
"context_is_admin": [["role:admin"]],
834+
"admin_or_owner": [["is_admin:True"], ["project_id:%(project_id)s"]], <a class="co" id="co_ch9-co-1" href="#callout_ch9-co-1"><img src="/usr/local/app/git_tmp/c3c6787bcdd5a68b82f8e9e0a5dd141c/doc/openstack-ops/callouts/1.png" alt="1"/></a>
835+
...
836+
</pre>
837+
</x:context>
838+
839+
<x:scenario label="with url.in.parens disabled (callout stealth XREF; XREF with no data-type)">
840+
<x:context>
841+
<x:param name="url.in.parens" select="0"/>
842+
</x:context>
843+
844+
<x:expect label="No URL should be generated in parentheses after the 'a'" test="not(exists(//h:span[@class='print_url_in_parens']))"/>
845+
</x:scenario>
846+
847+
<x:scenario label="with url.in.parens enabled (callout stealth XREF; XREF with no data-type)">
848+
<x:context>
849+
<x:param name="url.in.parens" select="1"/>
850+
</x:context>
851+
852+
<x:expect label="No URL should be generated in parentheses after the 'a'" test="not(exists(//h:span[@class='print_url_in_parens']))"/>
853+
</x:scenario>
854+
</x:scenario>
855+
830856
<!-- Tests for whether an HREF is considered to be an XREF (link within the same corpus) -->
831857
<x:scenario label="If an href starts with a '#'">
832858
<x:call template="href-is-xref">

0 commit comments

Comments
 (0)