Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing broken SiteTreeHTMLEditorFieldTest

  • Loading branch information...
commit 2c4ebd3cb9527a578ecd1ccba604e2d762381383 1 parent 90a154c
@halkyon halkyon authored
Showing with 12 additions and 10 deletions.
  1. +12 −10 tests/model/SiteTreeHTMLEditorFieldTest.php
View
22 tests/model/SiteTreeHTMLEditorFieldTest.php
@@ -53,16 +53,18 @@ public function testImageInsertion() {
$editor->setValue('<img src="assets/example.jpg" />');
$editor->saveInto($sitetree);
- $xml = new SimpleXMLElement($sitetree->Content);
- $this->assertNotNull($xml['alt'], 'Alt tags are added by default.');
- $this->assertNotNull($xml['title'], 'Title tags are added by default.');
-
- $editor->setValue('<img src="assets/example.jpg" alt="foo" title="bar" />');
- $editor->saveInto($sitetree);
-
- $xml = new SimpleXMLElement($sitetree->Content);
- $this->assertNotNull('foo', $xml['alt'], 'Alt tags are preserved.');
- $this->assertNotNull('bar', $xml['title'], 'Title tags are preserved.');
+ $parser = new CSSContentParser($sitetree->Content);
+ $xml = $parser->getByXpath('//img');
+ $this->assertEquals('', $xml[0]['alt'], 'Alt tags are added by default.');
+ $this->assertEquals('', $xml[0]['title'], 'Title tags are added by default.');
+
+ $editor->setValue('<img src="assets/example.jpg" alt="foo" title="bar" />');
+ $editor->saveInto($sitetree);
+
+ $parser = new CSSContentParser($sitetree->Content);
+ $xml = $parser->getByXpath('//img');
+ $this->assertEquals('foo', $xml[0]['alt'], 'Alt tags are preserved.');
+ $this->assertEquals('bar', $xml[0]['title'], 'Title tags are preserved.');
}
public function testImageTracking() {
Please sign in to comment.
Something went wrong with that request. Please try again.