-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI Framework] Create Button React components in UI Framework. (#10646)
* Create KuiButton, KuiLinkButton, KuiSubmitButton, and KuiButtonIcon React components in UI Framework. * Add Jest test coverage for UI Framework, generate report in ui_framework/jest/report. * Add UI Framework to linting task. * Update UI Framework README with instructions on creating and testing React components. * Add both React and HTML examples. * Add UI Framework Jest tests to npm test script. Create separate scripts for watching and generating coverage reports. * Fix appearance of kuiButtons with icons throughout Kibana, by adding a flexbox wrapper. * Improve accessibility of kuiButtonIcon. * Remove disabled attribute from KuiLinkButton. * Remove kuiButton-isDisabled class from KuiButton and KuiSubmitButton.
- Loading branch information
Showing
60 changed files
with
2,123 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,5 @@ selenium | |
*.swo | ||
*.out | ||
ui_framework/doc_site/build/*.js* | ||
ui_framework/jest/report | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const platform = require('os').platform(); | ||
const config = require('./utils/ui_framework_test_config'); | ||
|
||
module.exports = function (grunt) { | ||
grunt.registerTask('uiFramework:test', function () { | ||
const done = this.async(); | ||
Promise.all([uiFrameworkTest()]).then(done); | ||
}); | ||
|
||
function uiFrameworkTest() { | ||
const serverCmd = { | ||
cmd: /^win/.test(platform) ? '.\\node_modules\\.bin\\jest.cmd' : './node_modules/.bin/jest', | ||
args: [ | ||
'--env=jsdom', | ||
`--config=${JSON.stringify(config)}`, | ||
], | ||
opts: { stdio: 'inherit' } | ||
}; | ||
|
||
return new Promise((resolve, reject) => { | ||
grunt.util.spawn(serverCmd, (error, result, code) => { | ||
if (error || code !== 0) { | ||
const message = result.stderr || result.stdout; | ||
|
||
grunt.log.error(message); | ||
|
||
return reject(); | ||
} | ||
|
||
grunt.log.writeln(result); | ||
|
||
resolve(); | ||
}); | ||
|
||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const jest = require('jest'); | ||
const config = require('./ui_framework_test_config'); | ||
|
||
const argv = process.argv.slice(2); | ||
|
||
argv.push('--config', JSON.stringify(config)); | ||
|
||
jest.run(argv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const rootDir = 'ui_framework'; | ||
|
||
module.exports = { | ||
rootDir, | ||
collectCoverageFrom: [ | ||
'components/**/*.js', | ||
// Seems to be a bug with jest or micromatch, in which the above glob doesn't match subsequent | ||
// levels of directories, making this glob necessary. | ||
'components/**/**/*.js', | ||
'!components/index.js', | ||
'!components/**/*/index.js', | ||
], | ||
coverageDirectory: '<rootDir>/jest/report', | ||
coverageReporters: ['html'], | ||
moduleFileExtensions: ['jsx', 'js', 'json'], | ||
testPathIgnorePatterns: ['<rootDir>/(dist|doc_site|jest)/'], | ||
testEnvironment: 'node', | ||
testRegex: '.*\.test\.(js|jsx)$', | ||
snapshotSerializers: ['<rootDir>/../node_modules/enzyme-to-json/serializer'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["react", "@spalger/babel-presets"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"plugins": [ | ||
"jest" | ||
], | ||
"rules": { | ||
"jest/no-disabled-tests": "error", | ||
"jest/no-focused-tests": "error", | ||
"jest/no-identical-title": "error" | ||
}, | ||
"env": { | ||
"jest/globals": true | ||
} | ||
} |
Oops, something went wrong.