Skip to content
Permalink
Browse files

Update the Testing guide for CanJS 6.x

Part of #5119
  • Loading branch information...
Chasen Le Hara
Chasen Le Hara committed Sep 20, 2019
1 parent fcba08f commit 65a89f11ee20d139d71c172855d192ccbed8637e
Showing with 2,548 additions and 2,545 deletions.
  1. +26 −27 demos/testing/throttled-input.html
  2. +0 −2,518 docs/can-guides/topics/testing.md
  3. +55 −0 docs/can-guides/topics/testing/components-connect-append-child.html
  4. +52 −0 docs/can-guides/topics/testing/components-connect-manually.html
  5. +69 −0 docs/can-guides/topics/testing/components-dom-events-form.html
  6. +54 −0 docs/can-guides/topics/testing/components-dom-events-modal.html
  7. +84 −0 docs/can-guides/topics/testing/components-observable-object.html
  8. +871 −0 docs/can-guides/topics/testing/integration-testing.html
  9. +55 −0 docs/can-guides/topics/testing/models-connections.html
  10. +59 −0 docs/can-guides/topics/testing/models-query-logic-filter-members.html
  11. +53 −0 docs/can-guides/topics/testing/models-query-logic-is-member.html
  12. +47 −0 docs/can-guides/topics/testing/observable-objects-asynchronous-behavior.html
  13. +65 −0 docs/can-guides/topics/testing/observable-objects-basic-setup.html
  14. +54 −0 ...guides/topics/testing/observable-objects-properties-derived-from-asynchronous-behavior-async.html
  15. +59 −0 ...-guides/topics/testing/observable-objects-properties-derived-from-asynchronous-behavior-sync.html
  16. +77 −0 docs/can-guides/topics/testing/observable-objects-properties-derived-from-models.html
  17. +122 −0 docs/can-guides/topics/testing/routing-route-component-viewmodel-updates.html
  18. +107 −0 docs/can-guides/topics/testing/routing-route-component-viewmodel.html
  19. +80 −0 docs/can-guides/topics/testing/routing-route-component.html
  20. +47 −0 docs/can-guides/topics/testing/routing-route-data-updates.html
  21. +65 −0 docs/can-guides/topics/testing/routing-route-data-url-updates.html
  22. +447 −0 docs/can-guides/topics/testing/testing.md
@@ -1,31 +1,30 @@
<throttled-input></throttled-input>
<script id="demo-source" src="../../node_modules/steal/steal.js" dev-bundle>
import { Component } from "can";
import { StacheElement } from "can";
Component.extend({
tag: "throttled-input",
view: `
<input value:from="text" on:input:value:to="text" placeholder="Type Here, Then Wait">
<p>value: {{ text }}</p>
`,
ViewModel: {
text: {
value({ listenTo, lastSet, resolve }) {
let latest = "",
timeoutId = null;
listenTo(lastSet, (val) => {
latest = val;
timeoutId = clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
resolve(latest);
}, 500);
});
}
}
}
});
class ThrottledInput extends StacheElement {
static view = `
<input on:input:value:to="text" placeholder="Type Here, Then Wait" value:from="text" />
<p>value: {{ text }}</p>
`;
static props = {
text: {
value({ lastSet, listenTo, resolve }) {
let latest = "";
let timeoutId = null;
listenTo(lastSet, (val) => {
latest = val;
timeoutId = clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
resolve(latest);
}, 500);
});
}
}
};
}
customElements.define("throttled-input", ThrottledInput);
</script>

0 comments on commit 65a89f1

Please sign in to comment.
You can’t perform that action at this time.