-
-
Notifications
You must be signed in to change notification settings - Fork 144
Add version selector #156
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
Add version selector #156
Conversation
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 looks great! 🎉
We don't have to now but would it be possible to embed/bootstrap versions.json since it's known at build-time?
Part of the point of versions.json
is that it's shared by (and can be updated independent of) each of the deployed copies of the app, so we can't embed it 🙂
We could look at embedding the version information for the active app during the build, though, which I think would solve the flicker?
Can we make a moduleForAcceptance helper that abstracts the setupApplicationTest and setupMirage (and whatever else we add in the future)? What's the best way to do this in Ember 3?
I saw a suggestion at one point that something like this might become a part of the default blueprint:
// tests/helpers/setup.js
import { setupApplicationTest as qunitSetupApplicationTest } from 'ember-qunit';
export function setupApplicationTest(hooks) {
qunitSetupApplicationTest(hooks);
// add custom stuff here
}
And then in all your acceptance tests, you'd do:
import { setupApplicationTest } from 'dummy/tests/helpers/setup';
ember-cli-build.js
Outdated
@@ -25,6 +26,9 @@ module.exports = function(defaults) { | |||
tree: 'sandbox' | |||
} | |||
} | |||
}, | |||
'ember-cli-mirage': { | |||
directory: path.resolve(__dirname, path.join('tests', 'dummy', 'mirage')) |
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.
What is this doing?
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.
making mirage work when in-repo addons are present :( though I don't understand why it wasn't working, I found this answer in the issues. Let me poke around some 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.
Doesn't seem like a huge deal, I was just curious 🙂
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.
fixed it upstream :)
This would be perfect, we could even make a new Ember Data |
|
||
export default ModalDialog.extend({ | ||
|
||
renderInPlace: config.environment === 'test' |
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.
Since other parts of the code access the environment config through the Owner API, this probably should too.
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.
yep, I agree we should have consistent style.
Can someone explain to me the difference between importing config and
let config = getOwner(this).resolveRegistration('config:environment');
?
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.
To import config, you have to know the name of the host app. Since we're always targeting addons' dummy apps, we could get away with assuming dummy
in the import path, but there's nothing stopping someone from picking a different modulePrefix
for their dummy app, so using the owner API is safer.
Personally, I kind of like having the explicit repetition of calling both setup methods in each test file. Less guessing about what's going on when reading the tests file. |
cd6e715
to
985f150
Compare
I guess the question is, when will an acceptance test not need all the hooks? The reason I brought up the issue is because I added an ajax request on boot and I also added Mirage, and so existing acceptance tests no longer worked without Mirage running (the app 404'd). I think |
985f150
to
390cfff
Compare
Visual treatment
Logic around displaying shas vs. tags
Here's my reasoning behind the logic around showing shas vs. tags:
Current version in Nav
latest
, andlatest
points to a tag, then show the tag. Otherwise, show "LATEST".master
, andmaster
points to a tag, then show the tag. Otherwise, show "MASTER".All versions in version selector
latest
, the label is "Latest". Iflatest
has a tag, show tag on right-hand side. Otherwise, show sha.master
, the label is "master". Ifmaster
has a tag, show tag on right-hand side. Otherwise, show sha.Happy to discuss if anyone has feedback on this!
Some questions
versions.json
since it's known at build-time? We load it after render so there's a small flicker as we determine how to display the current version in the navmoduleForAcceptance
helper that abstracts thesetupApplicationTest
andsetupMirage
(and whatever else we add in the future)? What's the best way to do this in Ember 3?