• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!doctype html>
2<!--
3@license
4Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
5This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8Code distributed by Google as part of the polymer project is also
9subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10-->
11<html>
12<head>
13  <title>app-route-converter</title>
14
15  <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
16  <script src="../../web-component-tester/browser.js"></script>
17
18  <link rel="import" href="../../polymer/polymer.html">
19  <link rel="import" href="../app-route-converter.html">
20</head>
21<body>
22  <test-fixture id="BasicRouteConversion">
23    <template>
24      <app-route-converter>
25      </app-route-converter>
26    </template>
27  </test-fixture>
28
29  <script>
30    'use strict';
31
32    suite('<app-route-converter>', function() {
33      test('it bidirectionally maps path and queryParams to route', function() {
34        var converter = fixture('BasicRouteConversion');
35
36        var queryParams = {x: '10'};
37        converter.path = '/a/b/c';
38        converter.queryParams = queryParams;
39
40        expect(converter.route).to.be.deep.equal({
41          prefix: '',
42          path: '/a/b/c',
43          __queryParams: queryParams
44        });
45
46        converter.set('route.path', '/d/e/f');
47        expect(converter.path).to.be.equal('/d/e/f');
48
49        queryParams = {y: '11'};
50        converter.set('route.__queryParams', queryParams);
51        expect(converter.queryParams).to.be.deep.equal(queryParams);
52
53        queryParams['z'] = '12';
54        expect(converter.queryParams).to.be.deep.equal(queryParams);
55      });
56    });
57  </script>
58</body>
59