tomalec
tomalec

Reputation: 900

How to use dom-bind within test-fixture?

How can I use <template is="dom-bind"> within <test-fixture> with web-components-tester?

I have tried to use it Polymer 0.8 x-template way:

<test-fixture id="dom-bind-fixture">
    <template is="dom-bind">
        <h1>{{greeting}}</h2>
    </template>
</test-fixture>
<script>
    // ...
   var bound = fixture('dom-bind-fixture', {greeting: 'ohai thurr'});
</script>

which naturally fails, as dom-bind does not have stamp method.

Then, I tried just stamping it out of native <template> element:

<test-fixture id="dom-bind-fixture">
    <template>
        <h1>outside dom-bind</h1>
        <template is="dom-bind">
            <h2>inside dom-bind</h2>
        </template>
    </template>
</test-fixture>

But in non-Chrome browsers this one stamps only outside dom-bind.

Is there a way to make it work, or is it just a blocking bug in web-components-tester/test-fixture/dom-bind?

Upvotes: 2

Views: 442

Answers (1)

abendigo
abendigo

Reputation: 944

Use dom-template, ie:

<test-fixture id="dom-bind-fixture">
    <template is="dom-template">
        <h1>{{greeting}}</h2>
    </template>
</test-fixture>
<script>
    // ...
   var bound = fixture('dom-bind-fixture', {greeting: 'ohai thurr'});
</script>

Upvotes: 2

Related Questions