Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with databinding #33

Closed
srsudar opened this issue Jul 31, 2016 · 2 comments
Closed

Issues with databinding #33

srsudar opened this issue Jul 31, 2016 · 2 comments

Comments

@srsudar
Copy link

srsudar commented Jul 31, 2016

I'm struggling to get data binding to work.

I'm defining a custom element in a my-element.html file, like follows:

<dom-module id="my-element">
  <template>
    <style>
      :host {
        display: block;
        box-sizing: border-box;
      }
    </style>
      <div id="txt-url" class="card-content">{{captureUrl}}</div>
  </template>
  <script>
    Polymer({
      is: 'my-element',
      properties: { captureUrl: String }
    });
  </script>

Here is the relevant portion of my my-element-test.html file:

    <test-fixture id="cached-page-summary-fixture">
      <template>
        <cached-page-summary>
          <h2>seed-element</h2>
        </cached-page-summary>
      </template>
    </test-fixture>

    <script>
      suite('<cached-page-summary>', function() {

        var myEl;

        setup(function() {
          myEl = fixture('cached-page-summary-fixture', {captureUrl: 'the url'});
        });

        test('heading is captureUrl', function() {
          var urlDiv = myEl.$$('#txt-url');
          // this will obviously fail, but used for logging purposes
          assert.equal(urlDiv, boundData.captureUrl);
        });
    });
    </script>

When I run this I see urlDiv in the error message (console.log wasn't working for me), and the div is empty, without captureUrl bound and inserted into the function. What am I doing wrong here? Am I mis-using Polymer? Mis-using test-fixture?

@srsudar
Copy link
Author

srsudar commented Aug 1, 2016

I realized Stack Overflow might be a better place to ask this question, so I cross posted it there.

@srsudar
Copy link
Author

srsudar commented Aug 11, 2016

I eventually go this working with the stack overflow post linked above.

@srsudar srsudar closed this as completed Aug 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant