-
-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,7 @@ | |
'data': [ | ||
'templates/layout.xml', | ||
], | ||
'demo': [ | ||
'demo/pages.xml', | ||
], | ||
} |
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2016 Jairo Llopis <[email protected]> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<template id="canonical_demo" | ||
page="True" | ||
name="Canonical URL and pager demo"> | ||
<t t-call="website.layout"> | ||
<!-- Add a fake pager to test the rel=prev/next links --> | ||
<t t-set="pager" t-value="website.pager(request.httprequest.path, 100, 2, url_args=request.httprequest.args)"/> | ||
</t> | ||
</template> | ||
|
||
</odoo> |
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Jairo Llopis <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import test_tags |
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,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Jairo Llopis <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp.tests.common import HttpCase | ||
from lxml.html import document_fromstring | ||
|
||
|
||
class UICase(HttpCase): | ||
def setUp(self): | ||
super(UICase, self).setUp() | ||
self.url = "/page/website_canonical_url.canonical_demo" | ||
self.get = "?ultimate_answer=42" | ||
self.url_get = "%s%s" % (self.url, self.get) | ||
self.url_data = self.url_open(self.url_get) | ||
self.doc = document_fromstring(self.url_data.read()) | ||
|
||
def test_canonical(self): | ||
"""Canonical URL is built OK.""" | ||
node = self.doc.xpath("/html/head/link[@rel='canonical']")[0] | ||
self.assertEqual(node.attrib["href"], self.url) | ||
|
||
def test_pager_next(self): | ||
"""Next pager link is OK.""" | ||
node = self.doc.xpath("/html/head/link[@rel='next']")[0] | ||
self.assertEqual( | ||
node.attrib["href"], | ||
"%s/page/3%s" % (self.url, self.get), | ||
) | ||
|
||
def test_pager_prev(self): | ||
"""Prev pager link is OK.""" | ||
node = self.doc.xpath("/html/head/link[@rel='prev']")[0] | ||
self.assertEqual(node.attrib["href"], self.url_get) |