Skip to content
Snippets Groups Projects
Verified Commit b7fe3297 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

TST: add tests for long text property threshold

parent db88740f
Branches
Tags
2 merge requests!109Release 0.11.0,!104F long text properties
Pipeline #36727 passed
......@@ -347,7 +347,7 @@
</xsl:call-template>
</span>
<span class="spacer"></span>
<summary><div title="show more"><span class="caosdb-f-property-text-value"><xsl:value-of select="substring(normalize-space($value),0,$long-text-threshold)"/></span></div></summary>
<summary><div title="show more"><span class="caosdb-f-property-text-value"><xsl:value-of select="substring(normalize-space($value),0,$long-text-threshold + 1)"/></span></div></summary>
</details>
</xsl:when>
<xsl:otherwise>
......
......@@ -168,6 +168,27 @@ QUnit.test("single-value template with reference property.", function(assert) {
assert.equal($(link).find('.caosdb-id').length, 1, 'has caosdb-id span');
})
QUnit.test("single-value template with long text property.", function(assert) {
assert.equal(xml2str(callTemplate(this.entityXSL, 'single-value', {
'value': 'the feature is disabled',
'reference': 'false',
'boolean': 'false',
'long-text-threshold': 'DISABLED'
})), "<span xmlns=\"http://www.w3.org/1999/xhtml\" class=\"caosdb-f-property-single-raw-value caosdb-property-text-value caosdb-f-property-text-value caosdb-v-property-text-value\">the feature is disabled</span>", "disabled -> not in details tag");
assert.equal(xml2str(callTemplate(this.entityXSL, 'single-value', {
'value': 'this is too long',
'reference': 'false',
'boolean': 'false',
'long-text-threshold': '4'
})), "<details xmlns=\"http://www.w3.org/1999/xhtml\"><span class=\"caosdb-f-property-single-raw-value caosdb-property-text-value caosdb-f-property-text-value caosdb-v-property-text-value\">this is too long</span><span class=\"spacer\"></span><summary><div title=\"show more\"><span class=\"caosdb-f-property-text-value\">this</span></div></summary></details>", "too long -> shorted to 'this'");
assert.equal(xml2str(callTemplate(this.entityXSL, 'single-value', {
'value': 'this is not too long',
'reference': 'false',
'boolean': 'false',
'long-text-threshold': '140'
})), "<span xmlns=\"http://www.w3.org/1999/xhtml\" class=\"caosdb-f-property-single-raw-value caosdb-property-text-value caosdb-f-property-text-value caosdb-v-property-text-value\">this is not too long</span>", "not too long -> not details tag.");
})
QUnit.test("old version warning", function(assert) {
// with successor tag
var xmlstr = '<Record id="2345"><Version id="abcd1234"><Successor id="bcde2345"/></Version></Record>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment