chore(test): fix menu and select for strict null check (#5316)

This commit is contained in:
Andrew Seguin
2017-06-22 16:37:42 -07:00
committed by Jeremy Elbourn
parent 8b6efb12e8
commit d75720b4a3
2 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -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', () => {
+3 -2
View File
@@ -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))