-
Notifications
You must be signed in to change notification settings - Fork 180
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
[v4] create collapsed option #222
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4e58bbc
create collapse option to collapse geocoder control unless hovered/cl…
e61c03c
update docs
d64cd6f
test options.collapsed
54f5dbd
Update CHANGELOG.md
a254110
typo
33e0bb7
Merge branch 'version4' into v4-collapse-option
e590175
use blur instead of focusout
f5e0c78
Merge branch 'version4' into v4-collapse-option
22a03ce
Update API.md
a9bceb6
move tests to test.ui.js
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -133,11 +133,11 @@ test('geocoder', function(tt) { | |
once(function(e) { | ||
t.equal(e.features.length, 1, 'One result returned'); | ||
t.ok( | ||
e.features[0].place_name.indexOf('Tanzania') > -1, | ||
e.features[0].place_name.indexOf('Tanzania') > -1, | ||
'returns expected result' | ||
); | ||
t.ok( | ||
e.features[0].place_name.indexOf('Singida') > -1, | ||
e.features[0].place_name.indexOf('Singida') > -1, | ||
'returns expected result' | ||
); | ||
t.equal(e.config.limit, 1, 'sets limit to 1 for reverse geocodes'); | ||
|
@@ -454,5 +454,54 @@ test('geocoder', function(tt) { | |
t.end(); | ||
}); | ||
|
||
tt.test('options.collapsed=true', function(t) { | ||
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. nitpick: these tests look good, but should we move them to |
||
t.plan(1); | ||
setup({ | ||
collapsed: true | ||
}); | ||
var wrapper = container.querySelector('.mapboxgl-ctrl-geocoder'); | ||
t.equal(wrapper.classList.contains('geocoder-collapsed'), true, 'mapboxgl-ctrl-geocoder has `geocoder-collapsed` class'); | ||
t.end(); | ||
}); | ||
|
||
tt.test('options.collapsed=true, focus', function(t) { | ||
t.plan(1); | ||
setup({ | ||
collapsed: true | ||
}); | ||
var wrapper = container.querySelector('.mapboxgl-ctrl-geocoder'); | ||
var inputEl = container.querySelector('.mapboxgl-ctrl-geocoder input'); | ||
// focus input, remove geocoder-collapsed | ||
var focusEvent = document.createEvent('Event'); | ||
focusEvent.initEvent("focus", true, true); | ||
inputEl.dispatchEvent(focusEvent); | ||
t.equal(wrapper.classList.contains('geocoder-collapsed'), false, 'mapboxgl-ctrl-geocoder does not have `geocoder-collapsed` class when inputEl in focus'); | ||
t.end(); | ||
}); | ||
|
||
tt.test('options.collapsed=true, hover', function(t) { | ||
t.plan(1); | ||
setup({ | ||
collapsed: true | ||
}); | ||
var wrapper = container.querySelector('.mapboxgl-ctrl-geocoder'); | ||
// hover input, remove geocoder-collapsed | ||
var hoverEvent = document.createEvent('Event'); | ||
hoverEvent.initEvent("mouseenter", true, true); | ||
wrapper.dispatchEvent(hoverEvent); | ||
t.equal(wrapper.classList.contains('geocoder-collapsed'), false, 'mapboxgl-ctrl-geocoder does not have `geocoder-collapsed` class when wrapper hovered'); | ||
t.end(); | ||
}); | ||
|
||
tt.test('options.collapsed=false', function(t) { | ||
t.plan(1); | ||
setup({ | ||
collapsed: false | ||
}); | ||
var wrapper = container.querySelector('.mapboxgl-ctrl-geocoder'); | ||
t.equal(wrapper.classList.contains('geocoder-collapsed'), false, 'mapboxgl-ctrl-geocoder does not have `geocoder-collapsed` class'); | ||
t.end(); | ||
}); | ||
|
||
tt.end(); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
"unless until", maybe just "until"?
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.
thank you!