polymer

How to measure common coverage for Polymer components + .js files?

三世轮回 提交于 2019-12-03 08:49:43
How to measure common coverage for Polymer components with all .js files in solution (for non-component tests QUnit is used)? I tried karma-coverage , but it works only for .js files. For Polymer, you would normally use web-component-tester (WCT) to test your components, and the web-component-tester-istanbul plugin for code coverage. You'd configure wct.conf.json in the root of your project with something like this: { "suites": [ "test/components/my-view1/my-view1.html" ], "plugins": { "istanbul": { "dir": "./build/coverage", "reporters": [ "text-summary", "lcov" ], "include": [ "*.js", "*

Polymer 1.0: How to pass an event to a child-node element without using <iron-signals>?

限于喜欢 提交于 2019-12-03 07:46:42
This Stack Overflow answer suggests using <iron-signals> to broadcast an event down the DOM tree to a custom element. Below, I ask a different question. Question How do I: pass an event down to a direct child node (custom element) from a parent (custom element) without using <iron-signals> ? Code This is what I have so far. But it doesn't work. parent-element.html <dom-module id="parenet-element"> <template is="dom-bind"> <child-element></child-element> <paper-button on-tap="_handleTap"></paper-button> </template> </dom-module> <script> (function(){ Polymer({ is: 'parenet-element', _handleTap:

How to use Polymer (1.0) with Rails (4)?

隐身守侯 提交于 2019-12-03 05:52:35
Now that Polymer (1.0) is "Production Ready" Which is the best way to use it on Rails (4) ? I read a lot and I saw that all the solutions are deprecated, (For example using Gems like: likepolymer-rails, emcee , etc) I'm lost trying to create a good structure for the project, and the way to include all the polymer components, also I don't know if Sprocket could help or not. UPDATE (16 June 2015) : An official package has been released for polymer-rails . Please see polymer-elements-rails , which is the new and official repository which includes iron- , paper- , and neon-elements . I will be

Typescript with Polymer 1.0?

不打扰是莪最后的温柔 提交于 2019-12-03 05:47:20
I found this great article I had been using with Polymer 0.5 ( http://www.mikecann.co.uk/programming/tinkering-with-google-polymer-and-typescript/ ) for being able to use Typescript Classes for Polymer Elements. This approach no longer works with Polymer 1.0 . I tried class CreatorStudio extends Polymer.Class({}) { is = "creator-studio"; } /*(function () { Polymer(CreatorStudio.prototype); })();*/ document.registerElement("creator-studio", CreatorStudio.prototype); And a number of other approaches but can't seem to get the element to register the same as Polymer({is: "creator-studio"}); Anyone

How to distribute (insert) content nodes programmatically

北城以北 提交于 2019-12-03 04:03:53
Is there a way to programmatically distribute (insert) content from lightDOM to ShadowDOM? I would like to wrap every single child node into an element. For example : <my-list> <span>first element</span> <div>second element</div> <a>third element</a> </my-link> to be distributed as <my-list> <ul> <li> <span>first element</span> </li> <li> <div>second element</div> </li> <li> <a>third element</a> </li> </ul> </my-link> I need it not only to render that way, but also delegate entire HTML behavior (bindings, events, etc..) as each distributed node may contain entire app. I have tried appending

Polymer and PHP

流过昼夜 提交于 2019-12-03 03:39:19
Hi I am just beginning to learn Polymer. I collect data as below using PHP. I can embed this in a DIV and display some data but I would like to make this bit of code into a Polymer element with parameters that I can import and the json data also into an external Polymer element that I can use to populate the page. I am struggling to get started, I know this is basic but if anyone has a pointer to get me on my way that would be great. <?php $host="host"; $username="username"; $password="password"; $db_name="database"; $db_query="SELECT * FROM table"; $mysqli = new mysqli("$host", "$username", "

Polymer input change event

◇◆丶佛笑我妖孽 提交于 2019-12-03 03:31:09
All I want is to be able to get the input from a polymer element <paper-input> and alert it onchange WITHOUT creating a custom polymer element. issues: on-change doesn't do anything I doubt this.value will do anything Pseudocode: <!DOCTYPE html> <html> <head><!--insert proper head elements here--></head> <body> <paper-input floatingLabel label="test" on-change="alert(this.value)"></paper-input> </body> </html> I don't know if the OP wanted a change callback while typing...but for Polymer 1.0+ one can listen to the changes while typing simply use the on-input instead of on-change "event" <paper

Is it possible to share mixins across web components (and imports) in Polymer?

一世执手 提交于 2019-12-03 03:02:30
As a follow up to How to extend multiple elements with Polymer and Polymer multiple inheritence/composition , based on their answers, I wonder if it's possible to share mixins across multiple web components (and multiple imports) to reuse functionality. Mixins seem to be the only way to share functionality across multiple custom elements. However, it seems like you can only use a mixin within one import. Which means, if you have a mixin, that gives a web component a specific functionality (let's say draggable ), it's not possible to mix it into the construction of your Polymer element if it's

How can I handle a hover the Polymer way without external libraries?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I figured I would need to do something like: <li on-mouseover="{{ myHoverHandler }}">blah</li> because handling clicks looks like this: <li on-click="{{ myClickHandler }}">blah</li> I've tried using the way shown in the documentation here: declarative event mapping , but on-mouseenter and on-mouseover aren't working as expected. I'm also having trouble passing parameters to my handlers, but that's a different story. 回答1: on-mouseover and on-mouseout are correct, here's a demo as a Stack Snippet : <script src="//cdnjs.cloudflare.com/ajax/libs

Can I use polymer/web components in a native android app w/o Cordova?

ε祈祈猫儿з 提交于 2019-12-03 02:51:59
问题 If I'm not mistaken, you need a web server to use/test Polymer's web components (such as the paper elements) on your computer due to browser permissions issues stemming from loading local file:// s. (A simple solution is to navigate to the directory where the polymer files are you want to try and type python -m SimpleHTTPServer then load http://localhost:8000 and all is good.) But how about if I want to employ web components/Polymer elements in a native java android app inside a simple