cbvirtua 1.0.122 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/package.json +3 -5
  2. package/valid.txt +468 -0
  3. package/vue3-hash-calendar-main.zip +0 -0
  4. package/1.zip +0 -0
  5. package/7.zip +0 -0
  6. package/888.zip +0 -0
  7. package/Checkbox Checked-1.png +0 -0
  8. package/_/345/217/267 (1).svg" +0 -1
  9. package/_/345/217/267.svg +0 -1
  10. package/a.png +0 -0
  11. package/babel-plugin-async-lock-master.zip +0 -0
  12. package/build-own-react-main.zip +0 -0
  13. package/check_box.svg +0 -1
  14. package/check_box_outline_blank.svg +0 -1
  15. package/checkbox_unchecked.svg +0 -1
  16. package/floating-vue-main.zip +0 -0
  17. package/font_2009600_gpzp7pxtnw.zip +0 -0
  18. package/font_2553510_ciljc7axaw7.woff +0 -0
  19. package/font_2553510_ciljc7axaw7.woff2 +0 -0
  20. package/leetcode-javascript-master.zip +0 -0
  21. package/loginDemo-master.zip +0 -0
  22. package/mi.txt +0 -374
  23. package/mitt-main.zip +0 -0
  24. package/mp-weixin-back-main.zip +0 -0
  25. package/pdfsss.txt +0 -900
  26. package/sms-check-code-master.zip +0 -0
  27. package/sss.txt +0 -2
  28. package/study-summarize-master.zip +0 -0
  29. package/tool.txt +0 -19
  30. package/v-dropdown-menu-master.zip +0 -0
  31. package/v-track-master/v-track-master/.browserslistrc +0 -3
  32. package/v-track-master/v-track-master/.eslintignore +0 -3
  33. package/v-track-master/v-track-master/.eslintrc.js +0 -15
  34. package/v-track-master/v-track-master/.gitattributes +0 -1
  35. package/v-track-master/v-track-master/.github/FUNDING.yml +0 -12
  36. package/v-track-master/v-track-master/.github/workflows/node.js.yml +0 -29
  37. package/v-track-master/v-track-master/.travis.yml +0 -22
  38. package/v-track-master/v-track-master/.yarnrc +0 -1
  39. package/v-track-master/v-track-master/LICENSE +0 -21
  40. package/v-track-master/v-track-master/README.md +0 -131
  41. package/v-track-master/v-track-master/babel.config.js +0 -25
  42. package/v-track-master/v-track-master/build/rollup.config.base.js +0 -14
  43. package/v-track-master/v-track-master/build/rollup.config.browser.js +0 -21
  44. package/v-track-master/v-track-master/build/rollup.config.es.js +0 -11
  45. package/v-track-master/v-track-master/docs/.babelrc +0 -5
  46. package/v-track-master/v-track-master/docs/App.vue +0 -61
  47. package/v-track-master/v-track-master/docs/assets/app.scss +0 -197
  48. package/v-track-master/v-track-master/docs/assets/index.scss +0 -10
  49. package/v-track-master/v-track-master/docs/assets/mixins.scss +0 -64
  50. package/v-track-master/v-track-master/docs/assets/normalize.scss +0 -349
  51. package/v-track-master/v-track-master/docs/components/button.vue +0 -15
  52. package/v-track-master/v-track-master/docs/components/code-snippet.vue +0 -72
  53. package/v-track-master/v-track-master/docs/dist/css/app.2e14d2d6.css +0 -4
  54. package/v-track-master/v-track-master/docs/dist/css/chunk-vendors.c687a9b2.css +0 -1
  55. package/v-track-master/v-track-master/docs/dist/favicon.ico +0 -0
  56. package/v-track-master/v-track-master/docs/dist/fonts/element-icons.535877f5.woff +0 -0
  57. package/v-track-master/v-track-master/docs/dist/fonts/element-icons.732389de.ttf +0 -0
  58. package/v-track-master/v-track-master/docs/dist/js/app.efe84ade.js +0 -2
  59. package/v-track-master/v-track-master/docs/dist/js/app.efe84ade.js.map +0 -1
  60. package/v-track-master/v-track-master/docs/dist/js/chunk-vendors.c94e27ba.js +0 -13
  61. package/v-track-master/v-track-master/docs/dist/js/chunk-vendors.c94e27ba.js.map +0 -1
  62. package/v-track-master/v-track-master/docs/index.html +0 -1
  63. package/v-track-master/v-track-master/docs/main.js +0 -78
  64. package/v-track-master/v-track-master/docs/pages/block-show.vue +0 -177
  65. package/v-track-master/v-track-master/docs/pages/custom-events.vue +0 -291
  66. package/v-track-master/v-track-master/docs/pages/home.vue +0 -269
  67. package/v-track-master/v-track-master/docs/pages/started.vue +0 -151
  68. package/v-track-master/v-track-master/docs/pages/track-view.vue +0 -234
  69. package/v-track-master/v-track-master/docs/tracks/action.js +0 -37
  70. package/v-track-master/v-track-master/docs/tracks/events.js +0 -140
  71. package/v-track-master/v-track-master/docs/tracks/index.js +0 -13
  72. package/v-track-master/v-track-master/docs/utils/date.js +0 -219
  73. package/v-track-master/v-track-master/docs/utils/dom.js +0 -26
  74. package/v-track-master/v-track-master/jest.config.js +0 -18
  75. package/v-track-master/v-track-master/package.json +0 -67
  76. package/v-track-master/v-track-master/postcss.config.js +0 -5
  77. package/v-track-master/v-track-master/public/favicon.ico +0 -0
  78. package/v-track-master/v-track-master/public/index.html +0 -18
  79. package/v-track-master/v-track-master/src/hooks/index.js +0 -217
  80. package/v-track-master/v-track-master/src/index.js +0 -79
  81. package/v-track-master/v-track-master/src/utils/debug.js +0 -13
  82. package/v-track-master/v-track-master/src/utils/dom.js +0 -73
  83. package/v-track-master/v-track-master/src/utils/helper.js +0 -122
  84. package/v-track-master/v-track-master/src/utils/vis-monitor.js +0 -183
  85. package/v-track-master/v-track-master/tests/helper.js +0 -37
  86. package/v-track-master/v-track-master/tests/unit/.eslintrc.js +0 -5
  87. package/v-track-master/v-track-master/tests/unit/track-click-async.spec.js +0 -52
  88. package/v-track-master/v-track-master/tests/unit/track-click-delay.spec.js +0 -46
  89. package/v-track-master/v-track-master/tests/unit/track-click-native.spec.js +0 -84
  90. package/v-track-master/v-track-master/tests/unit/track-click-param.spec.js +0 -55
  91. package/v-track-master/v-track-master/tests/unit/track-click.spec.js +0 -47
  92. package/v-track-master/v-track-master/tests/unit/track-custom-event-async.spec.js +0 -61
  93. package/v-track-master/v-track-master/tests/unit/track-custom-event-delay.spec.js +0 -59
  94. package/v-track-master/v-track-master/tests/unit/track-custom-event-param.spec.js +0 -68
  95. package/v-track-master/v-track-master/tests/unit/track-custom-event.spec.js +0 -55
  96. package/v-track-master/v-track-master/tests/unit/track-show-custom-scroll-once.spec.js +0 -62
  97. package/v-track-master/v-track-master/tests/unit/track-show-custom-scroll.spec.js +0 -62
  98. package/v-track-master/v-track-master/tests/unit/track-show-once.spec.js +0 -55
  99. package/v-track-master/v-track-master/tests/unit/track-show-param.spec.js +0 -51
  100. package/v-track-master/v-track-master/tests/unit/track-show.spec.js +0 -55
  101. package/v-track-master/v-track-master/tests/unit/track-view-vif.spec.js +0 -54
  102. package/v-track-master/v-track-master/tests/unit/track-view-watch-delay.spec.js +0 -63
  103. package/v-track-master/v-track-master/tests/unit/track-view-watch.spec.js +0 -61
  104. package/v-track-master/v-track-master/tests/unit/track-view.spec.js +0 -32
  105. package/v-track-master/v-track-master/vue.config.js +0 -45
  106. package/v-track-master/v-track-master/yarn.lock +0 -10186
  107. package/v-track-master.zip +0 -0
  108. package/vant-weapp-dev.zip +0 -0
  109. package/vue-autosize-input-master.zip +0 -0
  110. package/vue-awesome-dropdown-master.zip +0 -0
  111. package/vue-codemod-main.zip +0 -0
  112. package/vue-collapsed-main.zip +0 -0
  113. package/vue-input-code-master.zip +0 -0
  114. package/vue-jscodeshift-adapter-master.zip +0 -0
  115. package/vue-verify-master.zip +0 -0
  116. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/.hbuilderx/launch.json +0 -11
  117. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/App.vue +0 -17
  118. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/README.md +0 -13
  119. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/code.js +0 -408
  120. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/css/icon.css +0 -342
  121. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/css/style.scss +0 -119
  122. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/search/index.vue +0 -66
  123. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/tree.vue +0 -70
  124. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/main.js +0 -11
  125. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/manifest.json +0 -78
  126. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/chooseUser/chooseUser.vue +0 -69
  127. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/chooseUser/data.js +0 -96
  128. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/index/index.vue +0 -122
  129. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages.json +0 -25
  130. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/changelog.md +0 -80
  131. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/en.json +0 -7
  132. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/index.js +0 -8
  133. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json +0 -7
  134. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json +0 -7
  135. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/keypress.js +0 -45
  136. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/popup.js +0 -26
  137. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/uni-popup.uvue +0 -90
  138. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +0 -496
  139. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js +0 -45
  140. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue +0 -313
  141. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue +0 -143
  142. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue +0 -187
  143. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/package.json +0 -87
  144. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/readme.md +0 -17
  145. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/changelog.md +0 -8
  146. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/index.scss +0 -1
  147. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/package.json +0 -82
  148. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/readme.md +0 -4
  149. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/index.scss +0 -7
  150. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_border.scss +0 -3
  151. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_color.scss +0 -66
  152. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_radius.scss +0 -55
  153. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_space.scss +0 -56
  154. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_styles.scss +0 -167
  155. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_text.scss +0 -24
  156. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_variables.scss +0 -146
  157. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/tools/functions.scss +0 -19
  158. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/theme.scss +0 -31
  159. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/variables.scss +0 -62
  160. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/changelog.md +0 -22
  161. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/components/uni-transition/createAnimation.js +0 -131
  162. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/components/uni-transition/uni-transition.vue +0 -286
  163. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/package.json +0 -84
  164. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/readme.md +0 -11
  165. package//346/224/266/347/274/251/344/270/212/347/256/255/345/244/264 (1).svg" +0 -1
  166. package//346/224/266/347/274/251/344/270/212/347/256/255/345/244/264.svg +0 -1
  167. package//346/224/266/347/274/251/344/270/213/347/256/255/345/244/264.svg +0 -1
  168. package//346/224/266/347/274/251/347/256/255/345/244/264.svg +0 -1
  169. package//346/226/260/345/273/272 /346/226/207/346/234/254/346/226/207/346/241/243 (2).txt" +0 -90
  170. package//346/226/260/345/273/272 /346/226/207/346/234/254/346/226/207/346/241/243 (3).txt" +0 -142
  171. package//346/226/260/345/273/272 /346/226/207/346/234/254/346/226/207/346/241/243 (3).zip +0 -0
  172. package//346/226/260/345/273/272 /346/226/207/346/234/254/346/226/207/346/241/243.txt" +0 -59
  173. package//351/227/256/345/217/267.svg +0 -1
@@ -1,37 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-13 14:11:11
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 15:05:55
6
- */
7
- export const mockParentNode = el => {
8
- // mock dom parentNode
9
- Object.defineProperty(el, "parentNode", {
10
- get: () => document
11
- });
12
- };
13
-
14
- export const mockRect = el => {
15
- // https://github.com/jsdom/jsdom/issues/653
16
- el.getBoundingClientRect = () => ({
17
- width: 100,
18
- height: 100,
19
- top: 50,
20
- left: 50,
21
- right: 50,
22
- bottom: 50
23
- });
24
- };
25
-
26
- export const mockScrollTo = () => {
27
- // eslint-disable-next-line no-undef
28
- Element.prototype.scrollTo = jest
29
- .fn()
30
- .mockImplementation((x = 50, y = 50) => {
31
- const w = window;
32
- w.scrollX = x;
33
- w.scrollY = y;
34
- w.pageXOffset = x;
35
- w.pageYOffset = y;
36
- });
37
- };
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- env: {
3
- jest: true
4
- }
5
- };
@@ -1,52 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-09 19:08:17
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 22:30:28
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn();
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const TrackClickAsync = Vue.extend({
17
- template: `
18
- <div v-track:18015.click.async="{ fetchRest, rest }"></div>
19
- `,
20
- data() {
21
- return {
22
- rest: null
23
- };
24
- },
25
- methods: {
26
- async fetchRest() {
27
- const response = await Promise.resolve({ data: "success" });
28
- this.rest = response.data;
29
- }
30
- }
31
- });
32
-
33
- localVue.use(VTrack, {
34
- trackEvents
35
- });
36
-
37
- describe("TrackClickAsync", () => {
38
- it("确保异步的事件返回成功之后再上报埋点", done => {
39
- const wrapper = mount(TrackClickAsync, {
40
- localVue
41
- });
42
-
43
- wrapper.trigger("click");
44
- expect(wrapper.vm.rest).toBeNull();
45
- expect(mockTrackAction).toBeCalledTimes(0);
46
- wrapper.vm.$nextTick(() => {
47
- expect(wrapper.vm.rest).toBe("success");
48
- expect(mockTrackAction).toBeCalledTimes(1);
49
- done();
50
- });
51
- });
52
- });
@@ -1,46 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-09 21:41:47
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 22:31:03
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn(({ collaps }) => collaps);
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const TrackClick = Vue.extend({
17
- template: `
18
- <div v-track:18015.click.delay="{ handleClick, collaps }"></div>
19
- `,
20
- data() {
21
- return {
22
- collaps: false
23
- };
24
- },
25
- methods: {
26
- handleClick() {
27
- this.collaps = !this.collaps;
28
- }
29
- }
30
- });
31
-
32
- localVue.use(VTrack, {
33
- trackEvents
34
- });
35
-
36
- describe("TrackClick", () => {
37
- it("确保埋点在click事件之后上报", () => {
38
- const wrapper = mount(TrackClick, {
39
- localVue
40
- });
41
-
42
- wrapper.trigger("click");
43
- expect(mockTrackAction).toBeTruthy();
44
- expect(mockTrackAction).toBeCalledTimes(1);
45
- });
46
- });
@@ -1,84 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-05-28 17:46:45
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-05-28 18:37:50
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import VueRouter from "vue-router";
10
- import { mount, createLocalVue } from "@vue/test-utils";
11
-
12
- const localVue = createLocalVue();
13
- const mockTrackAction = jest.fn();
14
- const trackEvents = {
15
- 18015: mockTrackAction
16
- };
17
- const Button = Vue.extend({
18
- template: `
19
- <div @click="$emit('click')" />
20
- `
21
- });
22
- const TrackClickNative = Vue.extend({
23
- template: `
24
- <Button v-track:18015.click.native="handleNativeEvent"></Button>
25
- `,
26
- components: {
27
- Button
28
- },
29
- data() {
30
- return {
31
- count: 0
32
- };
33
- },
34
- methods: {
35
- handleNativeEvent() {
36
- this.count += 1;
37
- }
38
- }
39
- });
40
- const RouterLinkTrackClickNative = Vue.extend({
41
- template: `
42
- <router-link to="home" v-track:18015.click.native="handleNativeEvent" />
43
- `,
44
- data() {
45
- return {
46
- count: 0
47
- };
48
- },
49
- methods: {
50
- handleNativeEvent() {
51
- this.count += 1;
52
- }
53
- }
54
- });
55
-
56
- localVue.use(VueRouter);
57
- localVue.use(VTrack, {
58
- trackEvents
59
- });
60
-
61
- describe("TrackClickNative", () => {
62
- test("确保组件原生click事件、埋点事件正常触发,且埋点上报次数为1", () => {
63
- const wrapper = mount(TrackClickNative, {
64
- localVue
65
- });
66
-
67
- expect(wrapper.vm.count).toBe(0);
68
- wrapper.trigger("click");
69
- expect(wrapper.vm.count).toBe(1);
70
- expect(mockTrackAction).toBeCalledTimes(1);
71
- });
72
-
73
- test("确保组件原生click事件、埋点事件正常触发,且埋点上报次数为2", () => {
74
- const wrapper = mount(RouterLinkTrackClickNative, {
75
- localVue,
76
- stubs: ["router-link"]
77
- });
78
-
79
- expect(wrapper.vm.count).toBe(0);
80
- wrapper.trigger("click");
81
- expect(wrapper.vm.count).toBe(1);
82
- expect(mockTrackAction).toBeCalledTimes(2);
83
- });
84
- });
@@ -1,55 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-09 18:23:04
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 21:56:46
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn();
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const TrackClickHasParam = Vue.extend({
17
- template: `
18
- <div v-track:18015.click="{ handleClick, item }"></div>
19
- `,
20
- data() {
21
- return {
22
- item: {
23
- id: 1
24
- },
25
- id: 0
26
- };
27
- },
28
- methods: {
29
- handleClick({ id }) {
30
- this.id = id;
31
- }
32
- }
33
- });
34
-
35
- localVue.use(VTrack, {
36
- trackEvents
37
- });
38
-
39
- describe("TrackClickHasParam", () => {
40
- it("确保事件传参正确,并且点击事件次数等于埋点上报次数", () => {
41
- const wrapper = mount(TrackClickHasParam, {
42
- localVue
43
- });
44
- const vm = wrapper.vm;
45
-
46
- expect(vm.id).toBe(0);
47
- wrapper.setData({ item: { id: 1 } });
48
- wrapper.trigger("click");
49
- expect(vm.id).toBe(1);
50
- wrapper.setData({ item: { id: 2 } });
51
- wrapper.trigger("click");
52
- expect(vm.id).toBe(2);
53
- expect(mockTrackAction).toBeCalledTimes(2);
54
- });
55
- });
@@ -1,47 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-09 14:54:33
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-09 18:24:43
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn();
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const TrackClick = Vue.extend({
17
- template: `
18
- <div v-track:18015.click="handleClick"></div>
19
- `,
20
- data() {
21
- return {
22
- count: 0
23
- };
24
- },
25
- methods: {
26
- handleClick() {
27
- this.count += 1;
28
- }
29
- }
30
- });
31
-
32
- localVue.use(VTrack, {
33
- trackEvents
34
- });
35
-
36
- describe("TrackClick", () => {
37
- it("确保click事件、埋点事件正常触发,且只触发一次", () => {
38
- const wrapper = mount(TrackClick, {
39
- localVue
40
- });
41
-
42
- expect(wrapper.vm.count).toBe(0);
43
- wrapper.trigger("click");
44
- expect(wrapper.vm.count).toBe(1);
45
- expect(mockTrackAction).toBeCalledTimes(1);
46
- });
47
- });
@@ -1,61 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-13 22:00:04
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 22:54:09
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn(({ status }) => status);
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const Child = Vue.extend({
17
- template: `
18
- <div @click="$emit('search')" />
19
- `
20
- });
21
- const TrackCustomEventAsync = Vue.extend({
22
- template: `
23
- <child v-track:18015.search.async="{ fetchRest, rest }" />
24
- `,
25
- components: {
26
- child: Child
27
- },
28
- data() {
29
- return {
30
- rest: null
31
- };
32
- },
33
- methods: {
34
- async fetchRest() {
35
- const response = await Promise.resolve({ data: "success" });
36
- this.rest = response.data;
37
- }
38
- }
39
- });
40
-
41
- localVue.use(VTrack, {
42
- trackEvents
43
- });
44
-
45
- describe("TrackCustomEventAsync", () => {
46
- it("确保异步的自定义事件返回成功之后再上报埋点", done => {
47
- const wrapper = mount(TrackCustomEventAsync, {
48
- localVue
49
- });
50
- const vm = wrapper.vm;
51
-
52
- wrapper.find(Child).trigger("click");
53
- expect(vm.rest).toBeNull();
54
- expect(mockTrackAction).toBeCalledTimes(0);
55
- vm.$nextTick(() => {
56
- expect(vm.rest).toBe("success");
57
- expect(mockTrackAction).toBeCalledTimes(1);
58
- done();
59
- });
60
- });
61
- });
@@ -1,59 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-13 22:00:04
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 22:30:58
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn(({ status }) => status);
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const Child = Vue.extend({
17
- template: `
18
- <div @click="$emit('expand', { status })" />
19
- `,
20
- data() {
21
- return {
22
- status: true
23
- };
24
- }
25
- });
26
- const TrackCustomEventDelay = Vue.extend({
27
- template: `
28
- <child v-track:18015.expand.delay="handleExpand" />
29
- `,
30
- components: {
31
- child: Child
32
- },
33
- data() {
34
- return {
35
- status: false
36
- };
37
- },
38
- methods: {
39
- handleExpand({ status }) {
40
- this.status = status;
41
- }
42
- }
43
- });
44
-
45
- localVue.use(VTrack, {
46
- trackEvents
47
- });
48
-
49
- describe("TrackCustomEventDelay", () => {
50
- it("确保埋点在自定义事件之后上报", () => {
51
- const wrapper = mount(TrackCustomEventDelay, {
52
- localVue
53
- });
54
-
55
- wrapper.find(Child).trigger("click");
56
- expect(mockTrackAction).toBeTruthy();
57
- expect(mockTrackAction).toBeCalledTimes(1);
58
- });
59
- });
@@ -1,68 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-13 21:03:55
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-16 22:33:20
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn();
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const Child = Vue.extend({
17
- template: `
18
- <div @click="$emit('search', item)" />
19
- `,
20
- data() {
21
- return {
22
- item: {
23
- id: 0
24
- }
25
- };
26
- }
27
- });
28
- const TrackCustomEventParam = Vue.extend({
29
- template: `
30
- <child v-track:18015.search="handleClick" />
31
- `,
32
- components: {
33
- child: Child
34
- },
35
- data() {
36
- return {
37
- id: 0
38
- };
39
- },
40
- methods: {
41
- handleClick({ id }) {
42
- this.id = id;
43
- }
44
- }
45
- });
46
-
47
- localVue.use(VTrack, {
48
- trackEvents
49
- });
50
-
51
- describe("TrackCustomEventParam", () => {
52
- it("确保自定义事件传参正确,并且点击事件次数等于埋点上报次数", () => {
53
- const wrapper = mount(TrackCustomEventParam, {
54
- localVue
55
- });
56
- const vm = wrapper.vm;
57
- const childWrapper = wrapper.find(Child);
58
-
59
- expect(vm.id).toBe(0);
60
- childWrapper.setData({ item: { id: 1 } });
61
- childWrapper.trigger("click");
62
- expect(vm.id).toBe(1);
63
- childWrapper.setData({ item: { id: 2 } });
64
- childWrapper.trigger("click");
65
- expect(vm.id).toBe(2);
66
- expect(mockTrackAction).toBeCalledTimes(2);
67
- });
68
- });
@@ -1,55 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-13 21:03:55
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 22:17:26
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
-
11
- const localVue = createLocalVue();
12
- const mockTrackAction = jest.fn();
13
- const trackEvents = {
14
- 18015: mockTrackAction
15
- };
16
- const Child = Vue.extend({
17
- template: `
18
- <div @click="$emit('click')" />
19
- `
20
- });
21
- const TrackCustomEvent = Vue.extend({
22
- template: `
23
- <child v-track:18015.click="handleClick" />
24
- `,
25
- components: {
26
- child: Child
27
- },
28
- data() {
29
- return {
30
- count: 0
31
- };
32
- },
33
- methods: {
34
- handleClick() {
35
- this.count += 1;
36
- }
37
- }
38
- });
39
-
40
- localVue.use(VTrack, {
41
- trackEvents
42
- });
43
-
44
- describe("TrackCustomEvent", () => {
45
- it("确保自定义事件、埋点事件正常触发,且只触发一次", () => {
46
- const wrapper = mount(TrackCustomEvent, {
47
- localVue
48
- });
49
-
50
- expect(wrapper.vm.count).toBe(0);
51
- wrapper.find(Child).trigger("click");
52
- expect(wrapper.vm.count).toBe(1);
53
- expect(mockTrackAction).toBeCalledTimes(1);
54
- });
55
- });
@@ -1,62 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-12 21:03:46
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-04-13 22:58:00
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
- import { mockParentNode, mockRect } from "../helper";
11
-
12
- const localVue = createLocalVue();
13
- const mockTrackAction = jest.fn();
14
- const trackEvents = {
15
- 18015: mockTrackAction
16
- };
17
- const Cmp = Vue.extend({
18
- template: `<div></div>`
19
- });
20
- const CmpTrackShowCustomOnce = Vue.extend({
21
- template: `
22
- <span>
23
- <cmp ref="scroll" v-track:18015.show.custom.once="{ref: 'scroll'}" />
24
- </span>
25
- `,
26
- components: {
27
- cmp: Cmp
28
- }
29
- });
30
-
31
- localVue.use(VTrack, {
32
- trackEvents
33
- });
34
-
35
- jest.useFakeTimers();
36
-
37
- describe("CmpTrackShowCustomOnce", () => {
38
- it("确保组件完全可见之后触发埋点,且只触发一次", () => {
39
- const wrapper = mount(CmpTrackShowCustomOnce, { localVue });
40
- const vm = wrapper.find(Cmp).vm;
41
-
42
- mockParentNode(vm.$el);
43
- mockRect(vm.$el);
44
- vm.$emit("scroll");
45
- jest.runAllTimers();
46
- expect(mockTrackAction).toBeCalledTimes(1);
47
-
48
- [1, 2, 3].forEach(() => {
49
- vm.$emit("scroll");
50
- });
51
- jest.runAllTimers();
52
- expect(mockTrackAction).toBeCalledTimes(1);
53
-
54
- [1, 2, 3].forEach(async () => {
55
- await setTimeout(() => {
56
- vm.$emit("scroll");
57
- }, 300);
58
- });
59
- jest.runAllTimers();
60
- expect(mockTrackAction).toBeCalledTimes(1);
61
- });
62
- });
@@ -1,62 +0,0 @@
1
- /*
2
- * @Author: 宋慧武
3
- * @Date: 2019-04-12 21:03:46
4
- * @Last Modified by: 宋慧武
5
- * @Last Modified time: 2019-08-13 14:00:05
6
- */
7
- import Vue from "vue";
8
- import VTrack from "@/";
9
- import { mount, createLocalVue } from "@vue/test-utils";
10
- import { mockParentNode, mockRect } from "../helper";
11
-
12
- const localVue = createLocalVue();
13
- const mockTrackAction = jest.fn();
14
- const trackEvents = {
15
- 18015: mockTrackAction
16
- };
17
- const Cmp = Vue.extend({
18
- template: `<div></div>`
19
- });
20
- const TrackShowCustomScroll = Vue.extend({
21
- template: `
22
- <span>
23
- <cmp ref="scroll" v-track:18015.show.custom="{ref: 'scroll'}" />
24
- </span>
25
- `,
26
- components: {
27
- cmp: Cmp
28
- }
29
- });
30
-
31
- localVue.use(VTrack, {
32
- trackEvents
33
- });
34
-
35
- jest.useFakeTimers();
36
-
37
- describe("TrackShowCustomScroll", () => {
38
- it("确保组件完全可见之后触发埋点,且至少间隔200ms执行一下", () => {
39
- const wrapper = mount(TrackShowCustomScroll, { localVue });
40
- const vm = wrapper.find(Cmp).vm;
41
-
42
- mockParentNode(vm.$el);
43
- mockRect(vm.$el);
44
- vm.$emit("scroll");
45
- jest.runAllTimers();
46
- expect(mockTrackAction).toBeCalledTimes(1);
47
-
48
- // [1, 2, 3].forEach(() => {
49
- // vm.$emit("scroll");
50
- // });
51
- // jest.runAllTimers();
52
- // expect(mockTrackAction).toBeCalledTimes(2);
53
-
54
- // [1, 2, 3].forEach(async () => {
55
- // await setTimeout(() => {
56
- // vm.$emit("scroll");
57
- // }, 300);
58
- // });
59
- // jest.runAllTimers();
60
- // expect(mockTrackAction).toBeCalledTimes(5);
61
- });
62
- });