diff --git a/test/unit/components/waterfall.vue b/test/unit/components/waterfall.vue new file mode 100644 index 000000000..b60910883 --- /dev/null +++ b/test/unit/components/waterfall.vue @@ -0,0 +1,49 @@ + + + diff --git a/test/unit/get-webpack-conf.js b/test/unit/get-webpack-conf.js index 73ecfcb6e..2f1d20772 100644 --- a/test/unit/get-webpack-conf.js +++ b/test/unit/get-webpack-conf.js @@ -16,6 +16,10 @@ const webpackConfig = { ], postcss: getPostcssPlugin, resolve: { + modules: [ + path.resolve(process.cwd(), 'node_modules'), + 'node_modules' + ], extensions: [ '', '.js', diff --git a/test/unit/specs/waterfall.spec.js b/test/unit/specs/waterfall.spec.js new file mode 100644 index 000000000..dab152e82 --- /dev/null +++ b/test/unit/specs/waterfall.spec.js @@ -0,0 +1,72 @@ +import Waterfall from '../components/waterfall'; +import { mount } from 'avoriaz'; + +describe('Waterfall', () => { + let wrapper; + afterEach(() => { + wrapper && wrapper.destroy(); + }); + + it('create', (done) => { + const waterfallLowerSpy = sinon.spy(); + wrapper = mount(Waterfall, { + attachToDocument: true, + propsData: { + disabled: false, + list: [], + onWaterfallLower: waterfallLowerSpy + } + }); + + setTimeout(() => { + expect(waterfallLowerSpy.called).to.be.true; + done(); + }, 500); + }); + + it('test waterfall lower function', (done) => { + const waterfallLowerSpy = sinon.spy(function() { + wrapper.vm.list = wrapper.vm.list.concat([{ id: 1 }, { id: 2 }, { id: 3 }]); + wrapper.vm.disabled = true; + }); + wrapper = mount(Waterfall, { + attachToDocument: true, + propsData: { + disabled: false, + list: [{ id: 10 }], + onWaterfallLower: waterfallLowerSpy + } + }); + + setTimeout(() => { + const item = wrapper.find('.waterfall-item'); + expect(waterfallLowerSpy.calledOnce).to.be.true; + expect(item.length).to.equal(4); + expect(item[item.length - 1].text()).to.equal('3'); + done(); + }, 500); + }); + + it('test waterfall upper function', (done) => { + const waterfallUpperSpy = sinon.spy(function() { + wrapper.vm.list.unshift({ id: 1 }, { id: 2 }, { id: 3 }); + wrapper.vm.disabled = true; + }); + wrapper = mount(Waterfall, { + attachToDocument: true, + propsData: { + disabled: false, + list: [{ id: 10 }], + onWaterfallUpper: waterfallUpperSpy + } + }); + + setTimeout(() => { + const item = wrapper.find('.waterfall-item'); + expect(waterfallUpperSpy.calledOnce).to.be.true; + expect(item.length).to.equal(4); + expect(item[0].text()).to.equal('1'); + done(); + }, 500); + }); +}); diff --git a/yarn.lock b/yarn.lock index 563ce1a01..4adcc38eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -136,6 +136,12 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +aria-query@^0.3.0: + version "0.3.0" + resolved "http://registry.npm.qima-inc.com/aria-query/download/aria-query-0.3.0.tgz#cb8a9984e2862711c83c80ade5b8f5ca0de2b467" + dependencies: + ast-types-flow "0.0.7" + arr-diff@^2.0.0: version "2.0.0" resolved "http://registry.npm.qima-inc.com/arr-diff/download/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" @@ -225,6 +231,10 @@ assertion-error@^1.0.1: version "1.0.2" resolved "http://registry.npm.qima-inc.com/assertion-error/download/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" +ast-types-flow@0.0.7: + version "0.0.7" + resolved "http://registry.npm.qima-inc.com/ast-types-flow/download/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" + ast-types@0.9.6: version "0.9.6" resolved "http://registry.npm.qima-inc.com/ast-types/download/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" @@ -349,6 +359,15 @@ babel-eslint@^6.1.2: lodash.assign "^4.0.0" lodash.pickby "^4.0.0" +babel-eslint@^7.2.1: + version "7.2.2" + resolved "http://registry.npm.qima-inc.com/babel-eslint/download/babel-eslint-7.2.2.tgz#0da2cbe6554fd0fb069f19674f2db2f9c59270ff" + dependencies: + babel-code-frame "^6.22.0" + babel-traverse "^6.23.1" + babel-types "^6.23.0" + babylon "^6.16.1" + babel-generator@^6.24.0: version "6.24.0" resolved "http://registry.npm.qima-inc.com/babel-generator/download/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" @@ -756,7 +775,7 @@ babel-types@^6.0.19, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23 lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.0.18, babylon@^6.11.0, babylon@^6.15.0: +babylon@^6.0.18, babylon@^6.11.0, babylon@^6.15.0, babylon@^6.16.1: version "6.16.1" resolved "http://registry.npm.qima-inc.com/babylon/download/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" @@ -966,7 +985,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0: +builtin-modules@^1.0.0, builtin-modules@^1.1.1: version "1.1.1" resolved "http://registry.npm.qima-inc.com/builtin-modules/download/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -1306,7 +1325,7 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@2.9.0, commander@2.9.x, commander@^2.8.1, commander@^2.9.0: +commander@2.9.0, commander@2.9.x, commander@^2.8.1, commander@^2.9.0, commander@~2.9.0: version "2.9.0" resolved "http://registry.npm.qima-inc.com/commander/download/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1408,6 +1427,10 @@ constants-browserify@^1.0.0: version "1.0.0" resolved "http://registry.npm.qima-inc.com/constants-browserify/download/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" +contains-path@^0.1.0: + version "0.1.0" + resolved "http://registry.npm.qima-inc.com/contains-path/download/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + content-disposition@0.5.2: version "0.5.2" resolved "http://registry.npm.qima-inc.com/content-disposition/download/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" @@ -1658,6 +1681,10 @@ d@1: dependencies: es5-ext "^0.10.9" +damerau-levenshtein@^1.0.0: + version "1.0.4" + resolved "http://registry.npm.qima-inc.com/damerau-levenshtein/download/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514" + dashdash@^1.12.0: version "1.14.1" resolved "http://registry.npm.qima-inc.com/dashdash/download/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -1817,7 +1844,7 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -doctrine@^1.2.2: +doctrine@1.5.0, doctrine@^1.2.2: version "1.5.0" resolved "http://registry.npm.qima-inc.com/doctrine/download/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" dependencies: @@ -1937,6 +1964,10 @@ elliptic@^6.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" +emoji-regex@^6.1.0: + version "6.4.2" + resolved "http://registry.npm.qima-inc.com/emoji-regex/download/emoji-regex-6.4.2.tgz#a30b6fee353d406d96cfb9fa765bdc82897eff6e" + emojis-list@^2.0.0: version "2.1.0" resolved "http://registry.npm.qima-inc.com/emojis-list/download/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" @@ -2127,47 +2158,62 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-standard@^5.1.0: - version "5.3.5" - resolved "http://registry.npm.qima-inc.com/eslint-config-standard/download/eslint-config-standard-5.3.5.tgz#2b42bb5c9f0049b8527868e109c34ee22b13dcf6" +eslint-config-airbnb-base@^11.1.0: + version "11.1.3" + resolved "http://registry.npm.qima-inc.com/eslint-config-airbnb-base/download/eslint-config-airbnb-base-11.1.3.tgz#0e8db71514fa36b977fbcf977c01edcf863e0cf0" -eslint-friendly-formatter@^2.0.5: - version "2.0.7" - resolved "http://registry.npm.qima-inc.com/eslint-friendly-formatter/download/eslint-friendly-formatter-2.0.7.tgz#657f95a19af4989636afebb1cc9de6cebbd088ee" +eslint-config-airbnb@^14.1.0: + version "14.1.0" + resolved "http://registry.npm.qima-inc.com/eslint-config-airbnb/download/eslint-config-airbnb-14.1.0.tgz#355d290040bbf8e00bf8b4b19f4b70cbe7c2317f" dependencies: - chalk "^1.0.0" - extend "^3.0.0" - minimist "^1.2.0" - text-table "^0.2.0" + eslint-config-airbnb-base "^11.1.0" -eslint-loader@^1.3.0: - version "1.7.0" - resolved "http://registry.npm.qima-inc.com/eslint-loader/download/eslint-loader-1.7.0.tgz#9813e77046730191ab399938732dff7960c639cb" +eslint-import-resolver-node@^0.2.0: + version "0.2.3" + resolved "http://registry.npm.qima-inc.com/eslint-import-resolver-node/download/eslint-import-resolver-node-0.2.3.tgz#5add8106e8c928db2cba232bcd9efa846e3da16c" dependencies: - find-cache-dir "^0.1.1" - loader-fs-cache "^1.0.0" - loader-utils "^1.0.2" + debug "^2.2.0" object-assign "^4.0.1" - object-hash "^1.1.4" - rimraf "^2.6.1" + resolve "^1.1.6" -eslint-plugin-html@^1.3.0: - version "1.7.0" - resolved "http://registry.npm.qima-inc.com/eslint-plugin-html/download/eslint-plugin-html-1.7.0.tgz#2a5b03884d8d56adf9ad9864e9c036480fb629c9" +eslint-module-utils@^2.0.0: + version "2.0.0" + resolved "http://registry.npm.qima-inc.com/eslint-module-utils/download/eslint-module-utils-2.0.0.tgz#a6f8c21d901358759cdc35dbac1982ae1ee58bce" dependencies: - htmlparser2 "^3.8.2" + debug "2.2.0" + pkg-dir "^1.0.0" -eslint-plugin-html@^2.0.0: - version "2.0.1" - resolved "http://registry.npm.qima-inc.com/eslint-plugin-html/download/eslint-plugin-html-2.0.1.tgz#3a829510e82522f1e2e44d55d7661a176121fce1" +eslint-plugin-import@^2.2.0: + version "2.2.0" + resolved "http://registry.npm.qima-inc.com/eslint-plugin-import/download/eslint-plugin-import-2.2.0.tgz#72ba306fad305d67c4816348a4699a4229ac8b4e" dependencies: - htmlparser2 "^3.8.2" + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.2.0" + doctrine "1.5.0" + eslint-import-resolver-node "^0.2.0" + eslint-module-utils "^2.0.0" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + pkg-up "^1.0.0" -eslint-plugin-promise@^1.0.8: - version "1.3.2" - resolved "http://registry.npm.qima-inc.com/eslint-plugin-promise/download/eslint-plugin-promise-1.3.2.tgz#fce332d6f5ff523200a537704863ec3c2422ba7c" +eslint-plugin-jsx-a11y@^4.0.0: + version "4.0.0" + resolved "http://registry.npm.qima-inc.com/eslint-plugin-jsx-a11y/download/eslint-plugin-jsx-a11y-4.0.0.tgz#779bb0fe7b08da564a422624911de10061e048ee" + dependencies: + aria-query "^0.3.0" + ast-types-flow "0.0.7" + damerau-levenshtein "^1.0.0" + emoji-regex "^6.1.0" + jsx-ast-utils "^1.0.0" + object-assign "^4.0.1" -eslint-plugin-react@^6.9.0: +eslint-plugin-lean-imports@^0.3.3: + version "0.3.3" + resolved "http://registry.npm.qima-inc.com/eslint-plugin-lean-imports/download/eslint-plugin-lean-imports-0.3.3.tgz#acb835d23801d92d2ce119b752b97c953f96d865" + +eslint-plugin-react@^6.10.3: version "6.10.3" resolved "http://registry.npm.qima-inc.com/eslint-plugin-react/download/eslint-plugin-react-6.10.3.tgz#c5435beb06774e12c7db2f6abaddcbf900cd3f78" dependencies: @@ -2177,20 +2223,9 @@ eslint-plugin-react@^6.9.0: jsx-ast-utils "^1.3.4" object.assign "^4.0.4" -eslint-plugin-standard@^1.3.2: - version "1.3.3" - resolved "http://registry.npm.qima-inc.com/eslint-plugin-standard/download/eslint-plugin-standard-1.3.3.tgz#a3085451523431e76f409c70cb8f94e32bf0ec7f" - -eslint-plugin-vue@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.qima-inc.com/eslint-plugin-vue/download/eslint-plugin-vue-2.0.1.tgz#814aa24b5a892d1a95a9d65d980a11202e597e3b" - dependencies: - eslint-plugin-html "^2.0.0" - eslint-plugin-react "^6.9.0" - -eslint@^3.15.0: - version "3.18.0" - resolved "http://registry.npm.qima-inc.com/eslint/download/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" +eslint@^3.18.0: + version "3.19.0" + resolved "http://registry.npm.qima-inc.com/eslint/download/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" dependencies: babel-code-frame "^6.16.0" chalk "^1.1.3" @@ -2423,6 +2458,21 @@ faye-websocket@~0.11.0: dependencies: websocket-driver ">=0.5.1" +felint@^0.5.0-alpha.3: + version "0.5.0" + resolved "http://registry.npm.qima-inc.com/felint/download/felint-0.5.0.tgz#e1281863f894a05ae9d2239e7ae8372958831c2a" + dependencies: + babel-eslint "^7.2.1" + colors "~1.1.2" + commander "~2.9.0" + eslint "^3.18.0" + eslint-config-airbnb "^14.1.0" + eslint-plugin-import "^2.2.0" + eslint-plugin-jsx-a11y "^4.0.0" + eslint-plugin-lean-imports "^0.3.3" + eslint-plugin-react "^6.10.3" + js-yaml "^3.6.1" + figures@^1.3.5: version "1.7.0" resolved "http://registry.npm.qima-inc.com/figures/download/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -3129,7 +3179,7 @@ html-webpack-plugin@^2.22.0: pretty-error "^2.0.2" toposort "^1.0.0" -htmlparser2@^3.8.2, htmlparser2@^3.9.1: +htmlparser2@^3.9.1: version "3.9.2" resolved "http://registry.npm.qima-inc.com/htmlparser2/download/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338" dependencies: @@ -3627,7 +3677,7 @@ js-tokens@^3.0.0: version "3.0.1" resolved "http://registry.npm.qima-inc.com/js-tokens/download/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" -js-yaml@3.x, js-yaml@^3.4.3, js-yaml@^3.5.1: +js-yaml@3.x, js-yaml@^3.4.3, js-yaml@^3.5.1, js-yaml@^3.6.1: version "3.8.2" resolved "http://registry.npm.qima-inc.com/js-yaml/download/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" dependencies: @@ -3726,7 +3776,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.3.6" -jsx-ast-utils@^1.3.4: +jsx-ast-utils@^1.0.0, jsx-ast-utils@^1.3.4: version "1.4.0" resolved "http://registry.npm.qima-inc.com/jsx-ast-utils/download/jsx-ast-utils-1.4.0.tgz#5afe38868f56bc8cc7aeaef0100ba8c75bd12591" dependencies: @@ -3902,13 +3952,6 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -loader-fs-cache@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.qima-inc.com/loader-fs-cache/download/loader-fs-cache-1.0.1.tgz#56e0bf08bd9708b26a765b68509840c8dec9fdbc" - dependencies: - find-cache-dir "^0.1.1" - mkdirp "0.5.1" - loader-runner@^2.3.0: version "2.3.0" resolved "http://registry.npm.qima-inc.com/loader-runner/download/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" @@ -4006,6 +4049,10 @@ lodash.camelcase@^3.0.1: dependencies: lodash._createcompounder "^3.0.0" +lodash.cond@^4.3.0: + version "4.5.2" + resolved "http://registry.npm.qima-inc.com/lodash.cond/download/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" + lodash.create@3.1.1: version "3.1.1" resolved "http://registry.npm.qima-inc.com/lodash.create/download/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" @@ -4349,7 +4396,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "http://registry.npm.qima-inc.com/minimalistic-crypto-utils/download/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" -"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2: +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: version "3.0.3" resolved "http://registry.npm.qima-inc.com/minimatch/download/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: @@ -4596,10 +4643,6 @@ object-component@0.0.3: version "0.0.3" resolved "http://registry.npm.qima-inc.com/object-component/download/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291" -object-hash@^1.1.4: - version "1.1.7" - resolved "http://registry.npm.qima-inc.com/object-hash/download/object-hash-1.1.7.tgz#a8d83fdf5d4583a4e2e7ffc18e8915e08482ef52" - object-keys@^1.0.10, object-keys@^1.0.8: version "1.0.11" resolved "http://registry.npm.qima-inc.com/object-keys/download/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" @@ -4917,6 +4960,12 @@ pkg-dir@^1.0.0: dependencies: find-up "^1.0.0" +pkg-up@^1.0.0: + version "1.0.0" + resolved "http://registry.npm.qima-inc.com/pkg-up/download/pkg-up-1.0.0.tgz#3e08fb461525c4421624a33b9f7e6d0af5b05a26" + dependencies: + find-up "^1.0.0" + pluralize@^1.2.1: version "1.2.1" resolved "http://registry.npm.qima-inc.com/pluralize/download/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" @@ -6340,7 +6389,7 @@ tcomb@^2.5.1: version "2.7.0" resolved "http://registry.npm.qima-inc.com/tcomb/download/tcomb-2.7.0.tgz#10d62958041669a5d53567b9a4ee8cde22b1c2b0" -text-table@^0.2.0, text-table@~0.2.0: +text-table@~0.2.0: version "0.2.0" resolved "http://registry.npm.qima-inc.com/text-table/download/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"