[MM-43632] Ensure handleURLView is called when removing the target URL (#2074)
This commit is contained in:
@@ -315,7 +315,13 @@ describe('main/views/MattermostView', () => {
|
|||||||
|
|
||||||
it('should not emit tooltip URL if internal', () => {
|
it('should not emit tooltip URL if internal', () => {
|
||||||
mattermostView.handleUpdateTarget(null, 'http://server-1.com/path/to/channels');
|
mattermostView.handleUpdateTarget(null, 'http://server-1.com/path/to/channels');
|
||||||
expect(mattermostView.emit).not.toHaveBeenCalled();
|
expect(mattermostView.emit).toHaveBeenCalled();
|
||||||
|
expect(mattermostView.emit).not.toHaveBeenCalledWith(UPDATE_TARGET_URL, 'http://server-1.com/path/to/channels');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should still emit even if URL is blank', () => {
|
||||||
|
mattermostView.handleUpdateTarget(null, '');
|
||||||
|
expect(mattermostView.emit).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -360,6 +360,8 @@ export class MattermostView extends EventEmitter {
|
|||||||
log.silly('MattermostView.handleUpdateTarget', {tabName: this.tab.name, url});
|
log.silly('MattermostView.handleUpdateTarget', {tabName: this.tab.name, url});
|
||||||
if (url && !urlUtils.isInternalURL(urlUtils.parseURL(url), this.tab.server.url)) {
|
if (url && !urlUtils.isInternalURL(urlUtils.parseURL(url), this.tab.server.url)) {
|
||||||
this.emit(UPDATE_TARGET_URL, url);
|
this.emit(UPDATE_TARGET_URL, url);
|
||||||
|
} else {
|
||||||
|
this.emit(UPDATE_TARGET_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user