fix(docs): don't throw exception on the 404 page

Closes #8518
This commit is contained in:
Igor Minar
2014-08-29 16:12:38 -07:00
parent 22948807e3
commit 550ba01b32
2 changed files with 25 additions and 1 deletions

View File

@@ -1,6 +1,24 @@
'use strict';
describe('docs.angularjs.org', function () {
beforeEach(function() {
// read and clear logs from previous tests
browser.manage().logs().get('browser');
});
afterEach(function() {
// verify that there were no console errors in the browser
browser.manage().logs().get('browser').then(function(browserLog) {
expect(browserLog.length).toEqual(0);
if (browserLog.length) {
console.log('browser console errors: ' + require('util').inspect(browserLog));
}
});
});
describe('App', function () {
// it('should filter the module list when searching', function () {
// browser.get();
@@ -67,6 +85,12 @@ describe('docs.angularjs.org', function () {
browser.get('index-debug.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
});
it("should display links to code on GitHub", function() {
browser.get('index-debug.html#!/api/does/not/exist');
expect(element(by.css('h1')).getText()).toBe('Oops!');
});
});
describe("templates", function() {

View File

@@ -33,7 +33,7 @@ angular.module('DocsController', [])
$scope.navClass = function(navItem) {
return {
active: navItem.href && this.currentPage.path,
active: navItem.href && this.currentPage && this.currentPage.path,
'nav-index-section': navItem.type === 'section'
};
};