Commit 62ea7730 authored by benjifisher's avatar benjifisher
Browse files

92: Add more test cases

- anchor to the document root
- select based on inner text
- select items with sub-lists
parent 549c9497
...@@ -49,6 +49,13 @@ class DomRemoveTest extends MigrateProcessTestCase { ...@@ -49,6 +49,13 @@ class DomRemoveTest extends MigrateProcessTestCase {
// The fourth match is Item 3.1. // The fourth match is Item 3.1.
'<ul><li>Item 4</li><li>Item 5</li></ul>', '<ul><li>Item 4</li><li>Item 5</li></ul>',
], ],
'top-level li, limit 4' => [
$input_string,
// Both Html::load() and the dom process plugin wrap HTML snippets in
// <html> and <body> tags.
['selector' => '/html/body/ul/li', 'limit' => 4],
'<ul><li>Item 5</li></ul>',
],
'nested li, no limit' => [ 'nested li, no limit' => [
$input_string, $input_string,
['selector' => '//li//li'], ['selector' => '//li//li'],
...@@ -59,6 +66,16 @@ class DomRemoveTest extends MigrateProcessTestCase { ...@@ -59,6 +66,16 @@ class DomRemoveTest extends MigrateProcessTestCase {
['selector' => '//li//li', 'limit' => 1], ['selector' => '//li//li', 'limit' => 1],
'<ul><li>Item 1</li><li>Item 2</li><li><ul><li>Item 3.2</li></ul></li><li>Item 4</li><li>Item 5</li></ul>', '<ul><li>Item 1</li><li>Item 2</li><li><ul><li>Item 3.2</li></ul></li><li>Item 4</li><li>Item 5</li></ul>',
], ],
'specific item' => [
$input_string,
['selector' => '//li[text() = "Item 3.1"]'],
'<ul><li>Item 1</li><li>Item 2</li><li><ul><li>Item 3.2</li></ul></li><li>Item 4</li><li>Item 5</li></ul>',
],
'all items with sub-lists' => [
$input_string,
['selector' => '//li[./ul]'],
'<ul><li>Item 1</li><li>Item 2</li><li>Item 4</li><li>Item 5</li></ul>',
],
]; ];
return $cases; return $cases;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment