2

I wrote an element that is meant as a container of , and that sets fields as invalid depending on the server response.

I would love to write demo and tests for this component. However, both demo and tests require the component to receive a response from a server (the form gets submitted, and fields are set accordingly).

Is there a way to write something like this in Polymer?

1
  • For tests using WCT you can look into sinon or stubs. And for how demo how about json file?
    – a1626
    Jul 15, 2016 at 15:58

1 Answer 1

0

The answer is simple and straightforward: use SinonJs. Specifically, use the fakeServer feature which rewrites the Ajax call in the browser so that you application actually "thinks" it's talking to a server. Easy.

I am using it myself in hot-form-validator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.