vue-test.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import Vue = require("../index");
  2. class Test extends Vue {
  3. testProperties() {
  4. this.$data;
  5. this.$el;
  6. this.$options;
  7. this.$parent;
  8. this.$root;
  9. this.$children;
  10. this.$refs;
  11. }
  12. // test property reification
  13. $refs: {
  14. vue: Vue;
  15. vues: Vue[];
  16. }
  17. $els: {
  18. element: HTMLInputElement;
  19. elements: HTMLInputElement[];
  20. }
  21. testReification() {
  22. this.$refs.vue.$data;
  23. this.$refs.vues[0].$data;
  24. this.$els.element.value;
  25. this.$els.elements[0].value;
  26. }
  27. testMethods() {
  28. this.$watch("a", (val: number, oldVal: number) => {}, {
  29. immediate: true,
  30. deep: false
  31. })();
  32. this.$watch(() => {}, (val: number) => {});
  33. this.$get("");
  34. this.$set("key", "value");
  35. this.$delete("key");
  36. this.$eval("");
  37. this.$interpolate("");
  38. this.$log("");
  39. this.$on("", () => {});
  40. this.$once("", () => {});
  41. this.$off("", () => {});
  42. this.$emit("", 1, 2, 3);
  43. this.$broadcast("", 1, 2, 3);
  44. this.$dispatch("", 1, 2, 3);
  45. this.$appendTo("", () => {});
  46. this.$before("", () => {});
  47. this.$after("", () => {});
  48. this.$remove(() => {});
  49. this.$nextTick(function() {
  50. this.$nextTick;
  51. });
  52. this.$mount("#app");
  53. this.$destroy(true);
  54. }
  55. static testConfig() {
  56. const { config } = this;
  57. config.debug;
  58. config.delimiters;
  59. config.unsafeDelimiters;
  60. config.silent;
  61. config.async;
  62. config.devtools;
  63. }
  64. static testMethods() {
  65. this.extend({
  66. data() {
  67. return {
  68. msg: ""
  69. };
  70. }
  71. });
  72. this.nextTick(() => {});
  73. this.set({}, "", "");
  74. this.delete({}, "");
  75. this.directive("", {bind() {}});
  76. this.elementDirective("", {bind() {}});
  77. this.filter("", (value: number) => value);
  78. this.component("", { data: () => ({}) });
  79. this.use;
  80. this.mixin(Test);
  81. }
  82. }