Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 550ba01

Browse files
committed
fix(docs): don't throw exception on the 404 page
Closes #8518
1 parent 2294880 commit 550ba01

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

docs/app/e2e/docsAppE2E.js

+24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
'use strict';
22

33
describe('docs.angularjs.org', function () {
4+
5+
beforeEach(function() {
6+
// read and clear logs from previous tests
7+
browser.manage().logs().get('browser');
8+
});
9+
10+
11+
afterEach(function() {
12+
// verify that there were no console errors in the browser
13+
browser.manage().logs().get('browser').then(function(browserLog) {
14+
expect(browserLog.length).toEqual(0);
15+
if (browserLog.length) {
16+
console.log('browser console errors: ' + require('util').inspect(browserLog));
17+
}
18+
});
19+
});
20+
21+
422
describe('App', function () {
523
// it('should filter the module list when searching', function () {
624
// browser.get();
@@ -67,6 +85,12 @@ describe('docs.angularjs.org', function () {
6785
browser.get('index-debug.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
6886
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
6987
});
88+
89+
90+
it("should display links to code on GitHub", function() {
91+
browser.get('index-debug.html#!/api/does/not/exist');
92+
expect(element(by.css('h1')).getText()).toBe('Oops!');
93+
});
7094
});
7195

7296
describe("templates", function() {

docs/app/src/docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ angular.module('DocsController', [])
3333

3434
$scope.navClass = function(navItem) {
3535
return {
36-
active: navItem.href && this.currentPage.path,
36+
active: navItem.href && this.currentPage && this.currentPage.path,
3737
'nav-index-section': navItem.type === 'section'
3838
};
3939
};

0 commit comments

Comments
 (0)