Guest User

Untitled

a guest
Nov 21st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //myapp.specs.ts
  2. import Vue from "vue";
  3. import { mount } from 'avoriaz';
  4. import Component from "./component.vue"
  5.  
  6. describe("My App", () => {
  7. it("works", () => {
  8. const wrapper = mount(Component);
  9.  
  10. expect(wrapper.html()).toContain("Hello, World");
  11. });
  12. });
  13.  
  14. //myapp.vue
  15. <script lang="ts" src="./component.ts"></script>
  16. <template src="./template.html"></template>
  17. <style src="./styles/styles.css"></style>
  18.  
  19. //component.ts
  20. import { Foo } from "./foo"
  21.  
  22. export default {
  23. data() {
  24. return {
  25. isLoading: true,
  26. data: new Foo()
  27. }
  28. },
  29. created() {
  30. this.populate();
  31. },
  32. methods: {
  33. populate() {
  34. new FooRepository().get().then((fooData: Foo) => {
  35. this.isLoading = false;
  36. this.data = fooData;
  37. });
  38. }
  39. }
  40. }
  41.  
  42. //template.html
  43. <div v-if="!isLoading" >
  44. <h2>Heading</h2>
  45. <textarea name="myText" v-model="data.Text"></textarea>
  46. </div>
Add Comment
Please, Sign In to add comment