@@ 295-311 (lines=17) @@ | ||
292 | $this->assertEquals($expected, $htmldoc->getHTML()); |
|
293 | } |
|
294 | ||
295 | function testMultipleStylesheets28() { |
|
296 | $htmldoc = new InlineStyle(file_get_contents($this->basedir . '/testMultipleStylesheets.html')); |
|
297 | $htmldoc->applyStylesheet($htmldoc->extractStylesheets(null, $this->basedir)); |
|
298 | $expected = <<<HTML |
|
299 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
|
300 | <html> |
|
301 | <head><title>Example</title></head> |
|
302 | <body> |
|
303 | <p style='margin:0;padding:0 0 10px 0;background-image: url("someimage.jpg")'>Paragraph</p> |
|
304 | <strong style="font-weight: bold">Strong</strong> |
|
305 | <br> |
|
306 | </body> |
|
307 | </html> |
|
308 | ||
309 | HTML; |
|
310 | $this->assertEquals($expected, $htmldoc->getHTML()); |
|
311 | } |
|
312 | ||
313 | function testMediaStylesheets31() { |
|
314 | $htmldoc = new InlineStyle(file_get_contents($this->basedir . '/testMediaStylesheets31.html')); |
|
@@ 313-333 (lines=21) @@ | ||
310 | $this->assertEquals($expected, $htmldoc->getHTML()); |
|
311 | } |
|
312 | ||
313 | function testMediaStylesheets31() { |
|
314 | $htmldoc = new InlineStyle(file_get_contents($this->basedir . '/testMediaStylesheets31.html')); |
|
315 | $htmldoc->applyStylesheet($htmldoc->extractStylesheets(null, $this->basedir)); |
|
316 | $expected = <<<HTML |
|
317 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
|
318 | <html> |
|
319 | <head><title>Example</title></head> |
|
320 | <body> |
|
321 | <style type="text/css" media="print"> |
|
322 | h1{ |
|
323 | display:none; |
|
324 | } |
|
325 | </style> |
|
326 | <h1 style="color:yellow">An example title</h1> |
|
327 | <p style="color:yellow !important;line-height:1.5em">Paragraph 1</p> |
|
328 | </body> |
|
329 | </html> |
|
330 | ||
331 | HTML; |
|
332 | $this->assertEquals($expected, $htmldoc->getHTML()); |
|
333 | } |
|
334 | ||
335 | function testLinkedMediaStylesheets31() { |
|
336 | $htmldoc = new InlineStyle(file_get_contents($this->basedir . '/testLinkedMediaStylesheets31.html')); |
|
@@ 335-353 (lines=19) @@ | ||
332 | $this->assertEquals($expected, $htmldoc->getHTML()); |
|
333 | } |
|
334 | ||
335 | function testLinkedMediaStylesheets31() { |
|
336 | $htmldoc = new InlineStyle(file_get_contents($this->basedir . '/testLinkedMediaStylesheets31.html')); |
|
337 | $htmldoc->applyStylesheet($htmldoc->extractStylesheets(null, $this->basedir)); |
|
338 | $expected = <<<HTML |
|
339 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
|
340 | <html> |
|
341 | <head> |
|
342 | <title>Example</title> |
|
343 | <link rel="stylesheet" href="external.css" media="print"> |
|
344 | </head> |
|
345 | <body> |
|
346 | <h1>An example title</h1> |
|
347 | <p>Paragraph <strong style="font-weight: bold">1</strong></p> |
|
348 | </body> |
|
349 | </html> |
|
350 | ||
351 | HTML; |
|
352 | $this->assertEquals($expected, $htmldoc->getHTML()); |
|
353 | } |
|
354 | } |
|
355 |