-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Webpack & modernize Dropkick #346
Conversation
It's an ES6 class now! :D
This is such a better testing setup
tests/dropkick-test.js
Outdated
import Dropkick from '../src/dropkick.js'; | ||
|
||
|
||
function buildSelect(id, options) { |
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.
- Move this to test utils
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.
- Also do an after each clean up of the selects that were built
tests/mobile-test.js
Outdated
// assert.equal(navigator.userAgent, "Android"); | ||
|
||
// dk.refresh(); | ||
// }); |
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.
This can probably go away and use browser stack to run our tests on mobile devices
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.
Should add this comment to the file so it doesn't get lost. 😉
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.
I reached out to browser stack to see if we can get an account to run tests. I’ve got the setup going locally but I’m about to run out of test free test runs
tests/iframe-test.js
Outdated
// var dk = new Dropkick("#normal_select"); | ||
|
||
// dk.open(); | ||
// assert.equal(dk.isOpen, true); | ||
// $(".body").trigger("click"); | ||
// assert.equal(dk.isOpen, false); | ||
}); | ||
// }); |
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.
This probably can get moved into the main test file and create a helper that builds / cleans up iframe creation
tests/src/runner.html
Outdated
<script src="../../lib/polyfills/indexof.js"></script> | ||
<script src="../../lib/dropkick.js"></script> --> | ||
<script src="../../build/js/dropkick.min.js"></script> | ||
<script src="../../dist/dropkick.js"></script> | ||
<script src="jquery-1.11.2.js"></script> | ||
<script src="../../node_modules/qunitjs/qunit/qunit.js"></script> | ||
<script src="../unit/tests.js"></script> |
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.
Delete this
2e303c1
to
c3b4ee8
Compare
You've been great Travis, I promise. But CircleCi 2.0 is way better. I'm sorry.
Fix package.json typo
dist/index.html
Outdated
<script> | ||
var select = document.getElementById('normal_select'); | ||
var dropkick = new Dropkick(select); | ||
console.log(dropkick); |
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.
🤔
dist/index.html
Outdated
var select = document.getElementById('normal_select'); | ||
var dropkick = new Dropkick(select); | ||
console.log(dropkick); | ||
function close() { |
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.
Will dropkick.close()
not work in the onclick
up above?
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.
Yea, this was me hacking around before the test suite was up
karma.conf.js
Outdated
config.singleRun = true; | ||
config.browsers = ['Chrome_travis_ci']; | ||
} | ||
}; |
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.
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.
- TODO
tests/mobile-test.js
Outdated
// assert.equal(navigator.userAgent, "Android"); | ||
|
||
// dk.refresh(); | ||
// }); |
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.
Should add this comment to the file so it doesn't get lost. 😉
webpack.config.js
Outdated
|
||
// I hate this, but I guess you can't pass disable to uglify.. | ||
const plugins = [ extractSass ]; | ||
isProduction ? plugins.push(new UglifyJSPlugin()) : null ; |
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.
If you don't like this, what about this?
I thought it was tidy and reusable. Food for thought ¯\_(ツ)_/¯
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.
It felt more dirty than being able to do:
new UglifyJsPlugin({
disable: !isProduction
})
But I guess this isn’t terrible.
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.
Also I realize the ternary is moot. Just do
isProduction && plugins.push(...);
Or explicitly
if (isProduction) { plugins.push(...); }
karma.conf.js
Outdated
// CI config | ||
if (process.env.TRAVIS || process.env.CI) { | ||
config.singleRun = true; | ||
config.browsers = ['Chrome_travis_ci']; |
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.
This should include the browser stack launchers too
The browserstack tests are a little slow. If you want to run them you can by running `yarn test-browserstack`.
@wwilsman wanna give one last go? |
webpack.config.js
Outdated
|
||
// I hate this, but I guess you can't pass disable to uglify.. | ||
const plugins = [ extractSass ]; | ||
isProduction ? plugins.push(new UglifyJSPlugin()) : null ; |
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.
Also I realize the ternary is moot. Just do
isProduction && plugins.push(...);
Or explicitly
if (isProduction) { plugins.push(...); }
Also removed unnessary comment at the top of dropkick
🎉 |
What is this?
I hated the gulp setup I made 3 years ago so I decided to use webpack and modernize this repo like it badly needs.
What changed?
/lib
changed to/src
/build
changed to/dist
documentation.js
TODOs