mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(test): fix menu and select for strict null check (#5316)
This commit is contained in:
committed by
Jeremy Elbourn
parent
8b6efb12e8
commit
d75720b4a3
@@ -141,7 +141,9 @@ describe('MdMenu', () => {
|
||||
const menuPanel = overlayContainerElement.querySelector('.mat-menu-panel');
|
||||
|
||||
expect(menuPanel).toBeTruthy('Expected to find a menu panel.');
|
||||
expect(menuPanel.getAttribute('role')).toBe('menu', 'Expected panel to have the "menu" role.');
|
||||
|
||||
const role = menuPanel ? menuPanel.getAttribute('role') : '';
|
||||
expect(role).toBe('menu', 'Expected panel to have the "menu" role.');
|
||||
});
|
||||
|
||||
describe('positions', () => {
|
||||
|
||||
@@ -1461,8 +1461,9 @@ describe('MdSelect', () => {
|
||||
groupFixture.detectChanges();
|
||||
|
||||
const triggerTop = trigger.getBoundingClientRect().top;
|
||||
const optionTop = overlayContainerElement.querySelector('.cdk-overlay-pane md-option')
|
||||
.getBoundingClientRect().top;
|
||||
|
||||
const option = overlayContainerElement.querySelector('.cdk-overlay-pane md-option');
|
||||
const optionTop = option ? option.getBoundingClientRect().top : 0;
|
||||
|
||||
// Since the option is 18px higher than the trigger, it needs to be adjusted by 9px.
|
||||
expect(Math.floor(optionTop))
|
||||
|
||||
Reference in New Issue
Block a user