-
-
Notifications
You must be signed in to change notification settings - Fork 72
fix regression + basic test #70
Changes from all commits
0e7bd78
3bf6f77
c6f556a
8fb0f7f
31fe33f
133f568
24d96c4
d0757e9
242cf0c
edd30cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
|
|
||
| const path = require('path'); | ||
| const packagejson = require('./../../package.json'); | ||
|
|
||
| const dashLibraryName = packagejson.name.replace(/-/g, '_'); | ||
|
|
||
| module.exports = (preprocessor = {}, mode = 'development') => { | ||
| console.log('********** Webpack Environment Overrides **********'); | ||
| console.log('Preprocessor', JSON.stringify(preprocessor)); | ||
| console.log('mode', mode); | ||
|
|
||
| return { | ||
| entry: { | ||
| bundle: './src/dash-table/index.ts', | ||
| demo: ['./demo/index.js', './demo/index.html'], | ||
| }, | ||
| mode: mode, | ||
| output: { | ||
| path: path.resolve(__dirname, './../..', dashLibraryName), | ||
| filename: '[name].js', | ||
| library: dashLibraryName, | ||
| libraryTarget: 'window', | ||
| }, | ||
| externals: { | ||
| react: 'React', | ||
| 'react-dom': 'ReactDOM', | ||
| 'plotly.js': 'Plotly', | ||
| }, | ||
| module: { | ||
| rules: [ | ||
| { | ||
| test: /demo[/]index.html?$/, | ||
| loader: 'file-loader?name=index.[ext]' | ||
| }, | ||
| { | ||
| test: /\.ts(x?)$/, | ||
| exclude: /node_modules/, | ||
| loader: `babel-loader!ts-loader!webpack-preprocessor?${JSON.stringify(preprocessor)}` | ||
| }, | ||
| { | ||
| test: /\.js$/, | ||
| exclude: /node_modules/, | ||
| loader: `babel-loader!webpack-preprocessor?${JSON.stringify(preprocessor)}` | ||
|
|
||
| }, | ||
| { | ||
| test: /\.css$/, | ||
| use: [ | ||
| { loader: 'style-loader' }, | ||
| { loader: 'css-loader' } | ||
| ], | ||
| }, | ||
| { | ||
| test: /\.less$/, | ||
| use: [ | ||
| { loader: 'style-loader' }, | ||
| { loader: 'css-loader' }, | ||
| { loader: 'less-loader' } | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| resolve: { | ||
| alias: { | ||
| 'cypress': path.resolve('./tests/e2e/cypress/src'), | ||
| 'dash-table': path.resolve('./src/dash-table'), | ||
| 'core': path.resolve('./src/core'), | ||
| 'tests': path.resolve('./tests') | ||
| }, | ||
| extensions: ['.js', '.ts', '.tsx'] | ||
| } | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| declare module 'sheetclip' { | ||
| const value: any; | ||
| const value: { | ||
| prototype: { | ||
| parse: (text: string) => string[][]; | ||
| } | ||
| }; | ||
|
|
||
| export default value; | ||
| } |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,13 @@ | ||
| export default class Clipboard { | ||
| /*#if TEST_COPY_PASTE*/ | ||
| private static value: string; | ||
| /*#endif*/ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webpack-preprocessor allows for conditional/build based code. This sometimes makes for pretty involved code.. but is a lot more flexible than, say, having an alias to some folder in dev vs test vs prod.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have to be careful though.. for the editor there is no if..else.. so all the code co-exists |
||
|
|
||
| public static set(value: string): void { | ||
| /*#if TEST_COPY_PASTE*/ | ||
| Clipboard.value = value; | ||
| /*#endif*/ | ||
|
|
||
| const el = document.createElement('textarea'); | ||
| el.value = value; | ||
|
|
||
|
|
@@ -34,9 +42,17 @@ export default class Clipboard { | |
| } | ||
| } | ||
|
|
||
| public static get(ev: ClipboardEvent) { | ||
| return ev.clipboardData ? | ||
| ev.clipboardData.getData('text/plain') : | ||
| public static get(_ev: ClipboardEvent) { | ||
| let value; | ||
|
|
||
| /*#if TEST_COPY_PASTE*/ | ||
| value = Clipboard.value; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the copy value in a variable.. there's no event clipboard value in the test environment.. return the stored value instead! |
||
| /*#else*/ | ||
| value = _ev.clipboardData ? | ||
| _ev.clipboardData.getData('text/plain') : | ||
| undefined; | ||
| /*#endif*/ | ||
|
|
||
| return value; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build the test version..