From 550ba01b325fc29460030fc9c24fa00269dec2a9 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 29 Aug 2014 16:12:38 -0700 Subject: [PATCH] fix(docs): don't throw exception on the 404 page Closes #8518 --- docs/app/e2e/docsAppE2E.js | 24 ++++++++++++++++++++++++ docs/app/src/docs.js | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/app/e2e/docsAppE2E.js b/docs/app/e2e/docsAppE2E.js index d8733f7c..97889f6d 100644 --- a/docs/app/e2e/docsAppE2E.js +++ b/docs/app/e2e/docsAppE2E.js @@ -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() { diff --git a/docs/app/src/docs.js b/docs/app/src/docs.js index fc1a3e56..84ccef43 100644 --- a/docs/app/src/docs.js +++ b/docs/app/src/docs.js @@ -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' }; };