This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix(dropdown): align position with or without vertical scrollbar #6008
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -702,4 +702,33 @@ describe('uib-dropdown', function() { | |
}); | ||
}); | ||
}); | ||
|
||
describe('using dropdown-append-to-body with dropdown-menu-right class', function() { | ||
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. In a comment before this issue, can you mention |
||
function dropdown() { | ||
return $compile('<li style="float: right;" uib-dropdown dropdown-append-to-body><a href uib-dropdown-toggle>Toggle menu</a><ul uib-dropdown-menu class="dropdown-menu-right" id="dropdown-menu"><li><a href>Hello On Body</a></li></ul></li>')($rootScope); | ||
} | ||
|
||
beforeEach(function() { | ||
element = dropdown(); | ||
$document.find('body').append(element); | ||
|
||
var menu = $document.find('#dropdown-menu'); | ||
menu.css('position', 'absolute'); | ||
}); | ||
|
||
afterEach(function() { | ||
element.remove(); | ||
}); | ||
|
||
it('should align the menu correctly when the body has no vertical scrollbar', function() { | ||
var toggle = element.find('[uib-dropdown-toggle]'); | ||
var menu = $document.find('#dropdown-menu'); | ||
toggle.trigger('click'); | ||
|
||
// Get the offsets of the rightmost position of both the toggle and the menu (offset from the left of the window) | ||
var toggleRight = Math.round(toggle.offset().left + toggle.outerWidth()); | ||
var menuRight = Math.round(menu.offset().left + menu.outerWidth()); | ||
expect(menuRight).toBe(toggleRight); | ||
}); | ||
}); | ||
}); |
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.
Actually, the eslint issue had to do with using tabs instead of spaces (I used Notepad++ which isn't the best tool for the job).
Eslint passes now, but I can change this if you wish.
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.
Nah, not a big deal