diff --git a/Jenkinsfile b/Jenkinsfile index 93c7734de..2c7100ae5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,13 @@ @Library('jenkins-library' ) _ def pipeline = new org.js.LibPipeline(steps: this, - buildDockerImage: 'build-tools/node:14-ubuntu', - dockerImageName: 'soramitsu/soramitsu-js-ui-library', - libExamplesBuildCmds: ['yarn storybook:build'], - sonarProjectName: 'soramitsu-js-ui-library', - sonarProjectKey: 'jp.co.soramitsu:soramitsu-js-ui-library' - ) + buildDockerImage: 'build-tools/node:14-ubuntu', + dockerImageName: 'soramitsu/soramitsu-js-ui-library', + libExamplesBuildCmds: ['yarn storybook:build'], + sonarProjectName: 'soramitsu-js-ui-library', + sonarProjectKey: 'jp.co.soramitsu:soramitsu-js-ui-library', + sonarSrcPath: 'src', + sonarTestsPath: 'tests', + dojoProductType: 'Dev' +) pipeline.runPipeline() diff --git a/jest.config.js b/jest.config.js index 8b359f812..64836c2c1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,7 @@ module.exports = { - preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel' + preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel', + collectCoverage: true, + collectCoverageFrom: ['src/**/*.{ts,tsx}'], + coverageReporters: ['lcov'], + coveragePathIgnorePatterns: ['node_modules/', 'coverage/'], } diff --git a/package.json b/package.json index 8e0532051..56887b795 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "1.0.44", + "version": "1.0.45", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu/" @@ -19,8 +19,8 @@ "typings": "./lib/index.d.ts", "scripts": { "build": "rm -rf lib && rollup -c ./build/rollup.config.js", - "test:unit": "vue-cli-service test:unit", - "test:all": "yarn test:unit", + "test:unit": "vue-cli-service test:unit --coverage", + "test:all": "yarn test:unit --coverage", "lint": "vue-cli-service lint", "storybook:build": "vue-cli-service storybook:build -c config/storybook", "storybook:serve": "vue-cli-service storybook:serve -p 6006 -c config/storybook" diff --git a/src/components/Dropdown/SDropdownItem/SDropdownItem.vue b/src/components/Dropdown/SDropdownItem/SDropdownItem.vue index c14065911..5395e3198 100644 --- a/src/components/Dropdown/SDropdownItem/SDropdownItem.vue +++ b/src/components/Dropdown/SDropdownItem/SDropdownItem.vue @@ -13,6 +13,8 @@ import { Vue, Component, Prop } from 'vue-property-decorator' import ElDropdownItem from 'element-ui/lib/dropdown-item' +import { iconClass } from '../../Icon/utils' + @Component({ components: { ElDropdownItem } }) @@ -40,8 +42,7 @@ export default class SDropdownItem extends Vue { @Prop({ type: String }) readonly icon!: string get computedIcon (): string { - // TODO: add checks for invalid icons - return `s-icon-${this.icon}` + return iconClass(this.icon) } } diff --git a/src/components/Icon/SIcon/SIcon.vue b/src/components/Icon/SIcon/SIcon.vue index b68133403..30243da5b 100644 --- a/src/components/Icon/SIcon/SIcon.vue +++ b/src/components/Icon/SIcon/SIcon.vue @@ -6,7 +6,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator' import last from 'lodash/fp/last' -import { Icons16, Icons24, StatusIcons } from '../consts' +import { iconClass } from '../utils' @Component export default class SIcon extends Vue { @@ -33,20 +33,7 @@ export default class SIcon extends Vue { } get computedClass (): string { - if (!this.name) { - return '' - } - if (this.name.startsWith('el-icon')) { - return this.name - } - const is16Size = (Object.values(Icons16) as Array).includes(this.name) - const is24Size = (Object.values(Icons24) as Array).includes(this.name) - const isStatusIcon = (Object.values(StatusIcons) as Array).includes(this.name) - if (!(is16Size || is24Size || isStatusIcon)) { - console.warn(`'${this.name}' was not found`) - return '' - } - return `s-icon-${this.name}` + return iconClass(this.name) } get computedStyles () { diff --git a/src/components/Icon/utils.ts b/src/components/Icon/utils.ts new file mode 100644 index 000000000..6ba8724ea --- /dev/null +++ b/src/components/Icon/utils.ts @@ -0,0 +1,18 @@ +import { Icons16, Icons24, StatusIcons } from './consts' + +export const iconClass = (name: string): string => { + if (!name) { + return '' + } + if (name.startsWith('el-icon')) { + return name + } + const is16Size = (Object.values(Icons16) as Array).includes(name) + const is24Size = (Object.values(Icons24) as Array).includes(name) + const isStatusIcon = (Object.values(StatusIcons) as Array).includes(name) + if (!(is16Size || is24Size || isStatusIcon)) { + console.warn(`'${name}' was not found`) + return '' + } + return `s-icon-${name}` +} diff --git a/src/styles/table.scss b/src/styles/table.scss index b1fdba4a0..c9b8c14f7 100644 --- a/src/styles/table.scss +++ b/src/styles/table.scss @@ -39,10 +39,9 @@ .el-table thead { color: var(--s-color-base-content-tertiary); } -.el-table__empty-block { - .el-table__empty-text { - color: var(--s-color-base-content-tertiary); - } +.el-table__empty-block, +.el-table__empty-text { + color: var(--s-color-base-content-tertiary); } .el-table--group, .el-table--border,