polymer

How do you write end-to-end tests for Polymer (JS) based application (circa May 2015)?

萝らか妹 提交于 2019-12-04 23:54:45
问题 I have built a Polymer based application. I'd like to write some end-to-end tests (not unit tests, but user behavior integration tests) for it. How do I do this currently (May 2015)? 回答1: I spent the past few days looking into this problem. Despite the vast number of pages devoted to one related topic or another on the web, nothing documents a solution to this problem. I was able to piece together something that works. So here it is. Hope this is useful for those looking to write end-to-end

Polymer HTML Imports Deprecated

萝らか妹 提交于 2019-12-04 23:09:26
问题 So I've just got started with polymer and got this message: [Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated, and is planned to be removed in M65, around March 2018. Please refer to ....... for possible migration paths. After doing some reading it seems to be that <link rel="import" href="/SOR/bower_components/paper-input/paper-input.html"> Was causing the issue and rel=import for html was being deprecated. Is this right? If so what is the fix, how

polymer not working or displaying no elements

为君一笑 提交于 2019-12-04 22:24:30
Trying to display hello world using elements but nothing happens any help? index.html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> <script src="bower_components/webcomponentsjs/webcomponents.js"></script> <link rel="import" href="elements/hello-world.html"> </head> <body unresolved> <hello-world></hello-world> </body> </html> hello-world.html <link rel="import" href="../bower_components/polymer/polymer.html"> <polymer-element name="hello-world" nonscript> <template> <h2>Hello World</h2> </template> <

Polymer 1.x: Observers

人盡茶涼 提交于 2019-12-04 22:00:44
Ultimately, I want to select individual states from this geochart . But this question is limited to getting the observer labeled _computeData to fire in response to mutating the array of selected states. Reproduce the problem with the following steps: Open this jsBin . Clear the console. Select the state of Texas. Note the console reads: You selected: Colorado,South Dakota,Texas which is expected per this line: console.log('You selected: ' + this.selected); // Logs properly However, I expect the console to also read: selected per this line: _computeData: function() { console.log('selected'); /

Does Polymers template auto-binding break model property?

五迷三道 提交于 2019-12-04 20:27:16
I'm trying to use <template is="auto-binding"> to use Polymer Expressions inside my template. As for any other <template bind> I activate a template, by attaching model property, as described at Polymer Docs My code looks as follows: <template id="root" is="auto-binding"> List <ul> <template repeat="{{ item in list }}"> <li>{{item.desc}}</li> </template> </ul> </template> <script type="text/javascript"> var template = document.getElementById( "root" ); template.model = { "list": [{ "desc": "first" }, { "desc": "second" }] }; </script> JSBin here , as you can see here jsbin.com/fibuc/1/quiet it

HTML import not deduping

会有一股神秘感。 提交于 2019-12-04 20:23:31
So the first fact section in this HTML import article states that html imports know better than to request (and execute - if javascript) resources multiple times. This works within the framework of HTML imports but doesn't work for other type of imports (as in javascript). In this network view of the devtools you can see Polymer.html being loaded first from javascript ( d3.js ) then again from HTML imports ( my-app.html ) which I wasn't expecting. Is there a way to explicitly tell HTML imports that a resource has already been loaded (as in from javascript in this case)? If I understand this

“Corrupted Content Error” on Firefox with Polymer/Firebase

冷暖自知 提交于 2019-12-04 20:16:20
I have a Polymer app with service workers hosted with Firebase. The app works fine on every browser except Firefox. When you try to refresh the browser in Firefox after initial load (which works), it throws the following error: A ServiceWorker passed a redirected Response to FetchEvent.respondWith() while RedirectMode is not ‘follow’ The service-worker.js is auto-generated by the polymer-cli (v0.16.0). To address this known issue , set the redirect option to follow in your service worker's fetch() requests: fetch(..., { redirect: 'follow' }) 来源: https://stackoverflow.com/questions/40274429

Polymer 1.0 Data binding when object changes

大兔子大兔子 提交于 2019-12-04 19:45:54
I'm having trouble understanding how data-binding works now. On my index page I've got an object (obtained as JSON from a RESTful service), which works just fine when applied to a custom element like: <main-menu class="tiles-container ofvertical flex layout horizontal start" menuitems="{{menuitems}}"> </main-menu> var maintemplate = document.querySelector('#fulltemplate'); maintemplate.menuitems = JSON.parse(data.GetDesktopResult); This works as expected, and when I load my page with different users, main-menu changes as it should to show each user's desktop configuration. (This menuitems

How can i bind a dynamic function within a polymer component?

放肆的年华 提交于 2019-12-04 19:37:32
As far as my Polymer knowledge goes I can bind a function using the "on-*" syntax to a webcomponent method bind a function available in the global window namespace using vanilla html js binding (using onClick="...") But I want to bind a function (provided as property of datamodel objects) to the webcomponent template. One sidenote : Moving the datamodel objects to the global javascript namespace (i.e. window.*) is not an option. The example below does'nt work but reflects exactly my use case : ... Polymer('x-foo', { items : [ ..., { label : "ExampleCommand", action : function() { // do

Polymer if-template with filter: filter not updating

拈花ヽ惹草 提交于 2019-12-04 18:36:11
I am using an if-template to show or hide items in a list, within a Polymer-element. My template is based on a list of values, and filtered using a reference list. Updating the list of values yields the desired effect. However, changing the filter reference list (here removing one element) does not yield an update of the template. <!DOCTYPE html> <html> <head> <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.2.3/platform.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.2.3/polymer.js"></script> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <test