Skip to main content

Posts

Showing posts with the label vue

jsPDF for VUE

http://raw.githack.com/MrRio/jsPDF/master/ /*  * Let's demonstrate string splitting with the first page of Shakespeare's Romeo and Juliet!  * We'll use a 8.5 x 11 inch sheet, measuring everything in inches.  */ var pageWidth = 8.5,   lineHeight = 1.2,   margin = 0.5,   maxLineWidth = pageWidth - margin * 2,   fontSize = 24,   ptsPerInch = 72,   oneLineHeight = (fontSize * lineHeight) / ptsPerInch,   text =     "Two households, both alike in dignity,\n" +     "In fair Verona, where we lay our scene,\n" +     "From ancient grudge break to new mutiny,\n" +     "Where civil blood makes civil hands unclean.\n" +     "From forth the fatal loins of these two foes\n" +     "A pair of star-cross'd lovers take their life;\n" +     "Whole misadventured piteous overthrows\n" +     "Do with their death bury their parents' strife.\n" +     "...

jest - run test on individual file - and what need test to Vue file - test vue - vue-test-utils.vuejs.org

test vue: https://vue-test-utils.vuejs.org/api/wrapper/#isempty yarn test --testPathPattern=".*UsersTree.test.js" snapshot: https://jestjs.io/docs/en/snapshot-testing For VUE: https://vue-test-utils.vuejs.org/guides/#getting-started 1. Visuals expect(wrapper.element).toMatchSnapshot() expect(wrapper.html()).toContain('primary--text') 2. Computed expect(wrapper.vm.items[0]).toHaveProperty('name', 'FreshinUp') 3. method const wrapper = shallowMount(Component, { propsData: { } }) wrapper.setData({ }) await wrapper.vm.$nextTick() expect(wrapper.html()).toContain('xxx') })