aboutsummaryrefslogtreecommitdiff
path: root/catapult/third_party/polymer/components/app-route/test/app-route-converter.html
diff options
context:
space:
mode:
Diffstat (limited to 'catapult/third_party/polymer/components/app-route/test/app-route-converter.html')
-rw-r--r--catapult/third_party/polymer/components/app-route/test/app-route-converter.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/catapult/third_party/polymer/components/app-route/test/app-route-converter.html b/catapult/third_party/polymer/components/app-route/test/app-route-converter.html
new file mode 100644
index 00000000..b5b8c559
--- /dev/null
+++ b/catapult/third_party/polymer/components/app-route/test/app-route-converter.html
@@ -0,0 +1,58 @@
+<!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>