mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
update tests and doc
This commit is contained in:
parent
0d15cb02cd
commit
d1f7e6959f
@ -175,7 +175,7 @@ class DBText extends DBString
|
|||||||
*
|
*
|
||||||
* @param int $characters Number of characters in the summary
|
* @param int $characters Number of characters in the summary
|
||||||
* @param string $keywords Supplied string ("keywords"). Will fall back to 'Search' querystring arg.
|
* @param string $keywords Supplied string ("keywords"). Will fall back to 'Search' querystring arg.
|
||||||
* @param bool $highlight Add a highlight <span> element around search query?
|
* @param bool $highlight Add a highlight <mark> element around search query?
|
||||||
* @param string $prefix Prefix text
|
* @param string $prefix Prefix text
|
||||||
* @param string $suffix Suffix text
|
* @param string $suffix Suffix text
|
||||||
* @return string HTML string with context
|
* @return string HTML string with context
|
||||||
|
@ -295,21 +295,21 @@ class DBHTMLTextTest extends SapphireTest
|
|||||||
'This is some text. It is a test',
|
'This is some text. It is a test',
|
||||||
20,
|
20,
|
||||||
'test',
|
'test',
|
||||||
'... text. It is a <span class="highlight">test</span>'
|
'... text. It is a <mark>test</mark>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// Retains case of original string
|
// Retains case of original string
|
||||||
'This is some test text. Test test what if you have multiple keywords.',
|
'This is some test text. Test test what if you have multiple keywords.',
|
||||||
50,
|
50,
|
||||||
'some test',
|
'some test',
|
||||||
'This is <span class="highlight">some</span> <span class="highlight">test</span> text.'
|
'This is <mark>some</mark> <mark>test</mark> text.'
|
||||||
. ' <span class="highlight">Test</span> <span class="highlight">test</span> what if you have...'
|
. ' <mark>Test</mark> <mark>test</mark> what if you have...'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'Here is some text & HTML included',
|
'Here is some text & HTML included',
|
||||||
20,
|
20,
|
||||||
'html',
|
'html',
|
||||||
'... text & <span class="highlight">HTML</span> inc...'
|
'... text & <mark>HTML</mark> inc...'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'A dog ate a cat while looking at a Foobar',
|
'A dog ate a cat while looking at a Foobar',
|
||||||
@ -323,16 +323,16 @@ class DBHTMLTextTest extends SapphireTest
|
|||||||
100,
|
100,
|
||||||
'ate',
|
'ate',
|
||||||
// it should highlight 3 letters or more.
|
// it should highlight 3 letters or more.
|
||||||
'A dog <span class="highlight">ate</span> a cat while looking at a Foobar',
|
'A dog <mark>ate</mark> a cat while looking at a Foobar',
|
||||||
],
|
],
|
||||||
|
|
||||||
// HTML Content is plain-textified, and incorrect tags removed
|
// HTML Content is plain-textified, and incorrect tags removed
|
||||||
[
|
[
|
||||||
'<p>A dog ate a cat while <span class="highlight">looking</span> at a Foobar</p>',
|
'<p>A dog ate a cat while <mark>looking</mark> at a Foobar</p>',
|
||||||
100,
|
100,
|
||||||
'ate',
|
'ate',
|
||||||
// it should highlight 3 letters or more.
|
// it should highlight 3 letters or more.
|
||||||
'A dog <span class="highlight">ate</span> a cat while looking at a Foobar',
|
'A dog <mark>ate</mark> a cat while looking at a Foobar',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -586,7 +586,7 @@ class DBHTMLTextTest extends SapphireTest
|
|||||||
$field->FirstParagraph()
|
$field->FirstParagraph()
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'Replaced <span class="highlight">short</span> <span class="highlight">code</span> with this. home',
|
'Replaced <mark>short</mark> <mark>code</mark> with this. home',
|
||||||
$field->ContextSummary(500, 'short code')
|
$field->ContextSummary(500, 'short code')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -214,21 +214,21 @@ class DBTextTest extends SapphireTest
|
|||||||
'This is some text. It is a test',
|
'This is some text. It is a test',
|
||||||
20,
|
20,
|
||||||
'test',
|
'test',
|
||||||
'... text. It is a <span class="highlight">test</span>'
|
'... text. It is a <mark>test</mark>'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// Retains case of original string
|
// Retains case of original string
|
||||||
'This is some test text. Test test what if you have multiple keywords.',
|
'This is some test text. Test test what if you have multiple keywords.',
|
||||||
50,
|
50,
|
||||||
'some test',
|
'some test',
|
||||||
'This is <span class="highlight">some</span> <span class="highlight">test</span> text.'
|
'This is <mark>some</mark> <mark>test</mark> text.'
|
||||||
. ' <span class="highlight">Test</span> <span class="highlight">test</span> what if you have...'
|
. ' <mark>Test</mark> <mark>test</mark> what if you have...'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'Here is some text & HTML included',
|
'Here is some text & HTML included',
|
||||||
20,
|
20,
|
||||||
'html',
|
'html',
|
||||||
'... text & <span class="highlight">HTML</span> inc...'
|
'... text & <mark>HTML</mark> inc...'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'A dog ate a cat while looking at a Foobar',
|
'A dog ate a cat while looking at a Foobar',
|
||||||
@ -242,7 +242,7 @@ class DBTextTest extends SapphireTest
|
|||||||
100,
|
100,
|
||||||
'ate',
|
'ate',
|
||||||
// it should highlight 3 letters or more.
|
// it should highlight 3 letters or more.
|
||||||
'A dog <span class="highlight">ate</span> a cat while looking at a Foobar',
|
'A dog <mark>ate</mark> a cat while looking at a Foobar',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user