| <!doctype html> |
| <!-- |
| @license |
| Copyright (c) 2016 The Polymer Project Authors. All rights reserved. |
| This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt |
| The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt |
| Code distributed by Google as part of the polymer project is also |
| subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt |
| --> |
| <html> |
| <head> |
| <title>app-route-converter</title> |
| |
| <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| <script src="../../web-component-tester/browser.js"></script> |
| |
| <link rel="import" href="../../polymer/polymer.html"> |
| <link rel="import" href="../app-route-converter.html"> |
| </head> |
| <body> |
| <test-fixture id="BasicRouteConversion"> |
| <template> |
| <app-route-converter> |
| </app-route-converter> |
| </template> |
| </test-fixture> |
| |
| <script> |
| 'use strict'; |
| |
| suite('<app-route-converter>', function() { |
| test('it bidirectionally maps path and queryParams to route', function() { |
| var converter = fixture('BasicRouteConversion'); |
| |
| var queryParams = {x: '10'}; |
| converter.path = '/a/b/c'; |
| converter.queryParams = queryParams; |
| |
| expect(converter.route).to.be.deep.equal({ |
| prefix: '', |
| path: '/a/b/c', |
| __queryParams: queryParams |
| }); |
| |
| converter.set('route.path', '/d/e/f'); |
| expect(converter.path).to.be.equal('/d/e/f'); |
| |
| queryParams = {y: '11'}; |
| converter.set('route.__queryParams', queryParams); |
| expect(converter.queryParams).to.be.deep.equal(queryParams); |
| |
| queryParams['z'] = '12'; |
| expect(converter.queryParams).to.be.deep.equal(queryParams); |
| }); |
| }); |
| </script> |
| </body> |