This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #857 from groovecoder/seo-meta-html-spaces-840550
fix bug 840550 - fix PyQuery punctuation spacing
- Loading branch information
Showing
4 changed files
with
150 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from nose.tools import eq_ | ||
from test_utils import TestCase | ||
|
||
from wiki.helpers import get_seo_description | ||
|
||
|
||
class GetSEODescriptionTests(TestCase): | ||
|
||
def test_html_elements_spaces(self): | ||
# No spaces with html tags | ||
content = (u'<p><span class="seoSummary">The <strong>Document Object ' | ||
'Model' | ||
'</strong> (<strong>DOM</strong>) is an API for ' | ||
'<a href="/en-US/docs/HTML" title="en-US/docs/HTML">HTML</a> and ' | ||
'<a href="/en-US/docs/XML" title="en-US/docs/XML">XML</a> ' | ||
'documents. It provides a structural representation of the ' | ||
'document, enabling you to modify its content and visual ' | ||
'presentation by using a scripting language such as ' | ||
'<a href="/en-US/docs/JavaScript" ' | ||
'title="https://developer.mozilla.org/en-US/docs/JavaScript">' | ||
'JavaScript</a>.</span></p>') | ||
expected = ('The Document Object Model (DOM) is an API for HTML and ' | ||
'XML' | ||
' documents. It provides a structural representation of the' | ||
' document, enabling you to modify its content and visual' | ||
' presentation by using a scripting language such as' | ||
' JavaScript.') | ||
eq_(expected, get_seo_description(content, 'en-US')) | ||
|
||
content = (u'<p><span class="seoSummary"><strong>Cascading Style ' | ||
'Sheets</strong>, most of the time abbreviated in ' | ||
'<strong>CSS</strong>, is a ' | ||
'<a href="/en-US/docs/DOM/stylesheet">stylesheet</a> ' | ||
'language used to describe the presentation of a document ' | ||
'written in <a href="/en-US/docs/HTML" title="The ' | ||
'HyperText Mark-up Language">HTML</a></span> or <a ' | ||
'href="/en-US/docs/XML" title="en-US/docs/XML">XML</a> ' | ||
'(including various XML languages like <a ' | ||
'href="/en-US/docs/SVG" title="en-US/docs/SVG">SVG</a> or ' | ||
'<a href="/en-US/docs/XHTML" ' | ||
'title="en-US/docs/XHTML">XHTML</a>)<span ' | ||
'class="seoSummary">. CSS describes how the structured ' | ||
'element must be rendered on screen, on paper, in speech, ' | ||
'or on other media.</span></p>') | ||
expected = ('Cascading Style Sheets, most of the time abbreviated in ' | ||
'CSS, is a stylesheet language used to describe the ' | ||
'presentation of a document written in HTML. CSS ' | ||
'describes how the structured element must be rendered on ' | ||
'screen, on paper, in speech, or on other media.') | ||
eq_(expected, get_seo_description(content, 'en-US')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters