Add unit test for removing displa:none from emails

This commit is contained in:
vedanshujain 2020-04-03 13:49:28 +00:00
parent 6612d1f859
commit af810af57a
1 changed files with 13 additions and 0 deletions

View File

@ -50,4 +50,17 @@ class WC_Tests_WC_Emails extends WC_Unit_Test_Case {
$this->assertEquals( $expected, $result );
}
/**
* Test that we remove elemets with style display none from html mails.
*/
public function test_remove_display_none_elements() {
$email = new WC_Email();
$email->email_type = 'html';
$str_present = 'Should be present!';
$str_removed = 'Should be removed!';
$result = $email->style_inline( "<div><div class='text'>$str_present</div><div style='display: none'>$str_removed</div> </div>" );
$this->assertTrue( false !== strpos( $result, $str_present ) );
$this->assertTrue( false === strpos( $result, $str_removed ) );
}
}