Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1433)

Side by Side Diff: chrome/common/extensions/docs/server2/reference_resolver_test.py

Issue 80183002: Correct $ref links in extensions documentation server relative location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/server2/reference_resolver.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import json 6 import json
7 import os 7 import os
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 '<pre><a href="bar.html#type-bon">bar.bon</a>({\nkey: value})', 163 '<pre><a href="bar.html#type-bon">bar.bon</a>({\nkey: value})',
164 resolver.ResolveAllLinks('<pre>$ref:[bar.bon]({\nkey: value})', 164 resolver.ResolveAllLinks('<pre>$ref:[bar.bon]({\nkey: value})',
165 namespace='baz')) 165 namespace='baz'))
166 166
167 # Allow bare "$ref:foo.bar." at the end of a string. 167 # Allow bare "$ref:foo.bar." at the end of a string.
168 self.assertEqual( 168 self.assertEqual(
169 '<a href="bar.html#type-bon">bar.bon</a>.', 169 '<a href="bar.html#type-bon">bar.bon</a>.',
170 resolver.ResolveAllLinks('$ref:bar.bon.', 170 resolver.ResolveAllLinks('$ref:bar.bon.',
171 namespace='baz')) 171 namespace='baz'))
172 172
173 # If a request is provided it should construct an appropriate relative link.
174 self.assertEqual(
175 'Hi <a href="../../bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>, '
176 '<a href="../../bar.bon.html#property-bar_bon_p3">Bon Bon</a>, '
177 '<a href="../../bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>',
178 resolver.ResolveAllLinks(
179 'Hi $ref:bar_bon_p3, $ref:[bar_bon_p3 Bon Bon], $ref:bar_bon_p3',
180 relative_to='big/long/path/bar.html',
181 namespace='bar.bon'))
182 self.assertEqual(
183 'Hi <a href="bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>, '
184 '<a href="bar.bon.html#property-bar_bon_p3">Bon Bon</a>, '
185 '<a href="bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>',
186 resolver.ResolveAllLinks(
187 'Hi $ref:bar_bon_p3, $ref:[bar_bon_p3 Bon Bon], $ref:bar_bon_p3',
188 relative_to='',
189 namespace='bar.bon'))
190 self.assertEqual(
191 'Hi <a href="bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>, '
192 '<a href="bar.bon.html#property-bar_bon_p3">Bon Bon</a>, '
193 '<a href="bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>',
194 resolver.ResolveAllLinks(
195 'Hi $ref:bar_bon_p3, $ref:[bar_bon_p3 Bon Bon], $ref:bar_bon_p3',
196 relative_to='bar.html',
197 namespace='bar.bon'))
198 self.assertEqual(
199 'Hi <a href="bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>, '
200 '<a href="bar.bon.html#property-bar_bon_p3">Bon Bon</a>, '
201 '<a href="bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>',
202 resolver.ResolveAllLinks(
203 'Hi $ref:bar_bon_p3, $ref:[bar_bon_p3 Bon Bon], $ref:bar_bon_p3',
204 relative_to='foo/bar.html',
205 namespace='bar.bon'))
206 self.assertEqual(
207 'Hi <a href="../bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>, '
208 '<a href="../bar.bon.html#property-bar_bon_p3">Bon Bon</a>, '
209 '<a href="../bar.bon.html#property-bar_bon_p3">bar_bon_p3</a>',
210 resolver.ResolveAllLinks(
211 'Hi $ref:bar_bon_p3, $ref:[bar_bon_p3 Bon Bon], $ref:bar_bon_p3',
212 relative_to='foo/baz/bar.html',
213 namespace='bar.bon'))
214
173 if __name__ == '__main__': 215 if __name__ == '__main__':
174 unittest.main() 216 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/reference_resolver.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698