-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins): add menu-bar extension point (#383)
- Loading branch information
Showing
16 changed files
with
131 additions
and
12 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
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,4 @@ | ||
'use strict'; | ||
|
||
export const RESULT = 'result'; | ||
export const MENU_BAR = 'menu-bar'; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
3 changes: 3 additions & 0 deletions
3
test/func/html-reporter-plugins/menu-bar/lib/menu-bar-item.css
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 @@ | ||
.menu-item__link.menu-bar-item { | ||
color: red; | ||
} |
20 changes: 20 additions & 0 deletions
20
test/func/html-reporter-plugins/menu-bar/lib/menu-bar-item.jsx
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 @@ | ||
import './menu-bar-item.css'; | ||
|
||
export default ['react', 'semantic-ui-react', function(React, {Dropdown}, {pluginName}) { | ||
class MenuBarItem extends React.Component { | ||
// allow the component to be placed only on "menu-bar" extension point | ||
static point = 'menu-bar'; | ||
|
||
render() { | ||
return ( | ||
<Dropdown.Item> | ||
<a className="menu-item__link menu-bar-item" href="#">{pluginName}</a> | ||
</Dropdown.Item> | ||
); | ||
} | ||
} | ||
|
||
return { | ||
MenuBarItem | ||
}; | ||
}]; |
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,7 @@ | ||
{ | ||
"name": "html-reporter-menu-bar-plugin", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"build": "webpack --config webpack.config.js" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
test/func/html-reporter-plugins/menu-bar/webpack.config.js
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,40 @@ | ||
const webpack = require('webpack'); | ||
|
||
module.exports = { | ||
entry: { | ||
plugin: './lib/menu-bar-item.jsx' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader' | ||
] | ||
}, | ||
{ | ||
test: /\.jsx$/, | ||
use: 'babel-loader', | ||
exclude: /node_modules/ | ||
} | ||
] | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
path: __dirname, | ||
library: '__hermione_html_reporter_register_plugin__', | ||
libraryTarget: 'jsonp' | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
uglifyOptions: { | ||
compress: { | ||
warnings: true, | ||
'drop_console': true, | ||
unsafe: true | ||
} | ||
} | ||
}) | ||
] | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
const {mkNestedSelector} = require('../utils'); | ||
|
||
describe('Test menu bar plugin', function() { | ||
const selector = '.main-menu .menu-bar'; | ||
|
||
it('should show menu bar with plugins applied', async function() { | ||
return this.browser | ||
.waitForVisible(selector) | ||
.assertView('menu bar plugins', selector); | ||
}); | ||
|
||
it('should show menu bar item on click', async function() { | ||
const menuSelector = mkNestedSelector(selector, '.menu'); | ||
|
||
return this.browser | ||
.waitForVisible(selector) | ||
.click(selector) | ||
.waitForVisible(menuSelector) | ||
.assertView('menu bar plugins clicked', [selector, menuSelector]); | ||
}); | ||
}); | ||
|