mercredi 2 septembre 2015

polymer 1.0 unit tests - how to bind properties to a child element?

I created a "child" element that is used by my custom "parent" element. My child element tag looks like this in my "parent" element:

<child-element fruits="{{fruits}}"></child-element>

fruits is an array in my "parent" element and is not a property of my "child" element. In my "child" element I have the following:

<template is="dom-repeat" items="[[fruits]]">
  <paper-card>[[item.flavor]]</paper-card>
</template>

How can I write a unit test for my "child" element to see if the dom-repeat is working? I want to write the test directly on the "child" element without use of "parent". I know how to write assertions against properties of the "child" element, but I don't know how to bind or pass the fruits array that it would normally listen to from the "parent", since the parent is not part of my test. How can I feed a fruits array to my "child" element?

Once I feed it the fruits array, how can I test to see if the corresponding paper-cards were created?

Aucun commentaire:

Enregistrer un commentaire