Commit 2027300c authored by Randall Leeds's avatar Randall Leeds

Remove a bunch more test boilerplate

Even when used as a CommonJS module, angular installs itself globally.
Rather than fight this in our tests, just leverage it. The mocks module
also installs itself under angular.mock. Therefore, none of the require
statements for angular or angular-mocks are necessary.
parent 5cbde100
{inject, module} = require('angular-mock') {inject, module} = angular.mock
describe 'h:AccountController', -> describe 'h:AccountController', ->
$scope = null $scope = null
......
{inject, module} = require('angular-mock') {inject, module} = angular.mock
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
class MockSession class MockSession
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
assert = chai.assert
describe 'annotation', -> describe 'annotation', ->
$compile = null $compile = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
assert = chai.assert
angular = require('angular')
describe 'form-input', -> describe 'form-input', ->
$compile = null $compile = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
assert = chai.assert
angular = require('angular')
describe 'form-validate', -> describe 'form-validate', ->
$compile = null $compile = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'match', -> describe 'match', ->
$compile = null $compile = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
assert = chai.assert
VISIBILITY_KEY ='hypothesis.visibility' VISIBILITY_KEY ='hypothesis.visibility'
VISIBILITY_PUBLIC = 'public' VISIBILITY_PUBLIC = 'public'
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
assert = chai.assert
describe 'share-dialog', -> describe 'share-dialog', ->
$scope = null $scope = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'simple-search', -> describe 'simple-search', ->
$compile = null $compile = null
......
var angularMock = require('angular-mock'); var module = angular.mock.module;
var module = angularMock.module; var inject = angular.mock.inject;
var inject = angularMock.inject;
describe('spinner', function () { describe('spinner', function () {
var $animate = null; var $animate = null;
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
assert = chai.assert
describe 'h:directives.status-button', -> describe 'h:directives.status-button', ->
$scope = null $scope = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'thread', -> describe 'thread', ->
$compile = null $compile = null
......
var angularMock = require('angular-mock'); var module = angular.mock.module;
var module = angularMock.module; var inject = angular.mock.inject;
var inject = angularMock.inject;
describe('persona', function () { describe('persona', function () {
var filter = null; var filter = null;
......
var angularMock = require('angular-mock'); var module = angular.mock.module;
var module = angularMock.module; var inject = angular.mock.inject;
var inject = angularMock.inject;
describe('urlencode', function () { describe('urlencode', function () {
var filter = null; var filter = null;
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'annotationMapper', -> describe 'annotationMapper', ->
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'AnnotationSync', -> describe 'AnnotationSync', ->
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'AnnotationUIController', -> describe 'AnnotationUIController', ->
$scope = null $scope = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'AnnotationUISync', -> describe 'AnnotationUISync', ->
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'annotationUI', -> describe 'annotationUI', ->
annotationUI = null annotationUI = null
......
{inject, module} = require('angular-mock') {inject, module} = angular.mock
describe "AnnotationViewerController", -> describe "AnnotationViewerController", ->
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'AppController', -> describe 'AppController', ->
$controller = null $controller = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'h', -> describe 'h', ->
fakeAnnotator = null fakeAnnotator = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
Channel = require('jschannel') Channel = require('jschannel')
describe 'Bridge', -> describe 'Bridge', ->
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'CrossFrame', -> describe 'CrossFrame', ->
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'Discovery', -> describe 'Discovery', ->
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
......
"use strict"; "use strict";
var mock = require('angular-mock'); var mock = angular.mock;
describe('h:features', function () { describe('h:features', function () {
var $httpBackend; var $httpBackend;
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
angular = require('angular')
describe 'form-respond', -> describe 'form-respond', ->
$scope = null $scope = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'host', -> describe 'host', ->
sandbox = null sandbox = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
describe 'identityProvider', -> describe 'identityProvider', ->
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'localStorage', -> describe 'localStorage', ->
fakeWindow = null fakeWindow = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'h:permissions', -> describe 'h:permissions', ->
sandbox = null sandbox = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'searchFilter', -> describe 'searchFilter', ->
sandbox = null sandbox = null
...@@ -8,7 +8,6 @@ describe 'searchFilter', -> ...@@ -8,7 +8,6 @@ describe 'searchFilter', ->
angular.module('h', []) angular.module('h', [])
.service('searchFilter', require('../search-filter')) .service('searchFilter', require('../search-filter'))
beforeEach module('h') beforeEach module('h')
beforeEach -> beforeEach ->
......
"use strict"; "use strict";
var mock = require('angular-mock'); var mock = angular.mock;
describe('h:session', function () { describe('h:session', function () {
var $httpBackend; var $httpBackend;
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'store', -> describe 'store', ->
$httpBackend = null $httpBackend = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'StreamController', -> describe 'StreamController', ->
$controller = null $controller = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'streamer', -> describe 'streamer', ->
WebSocket = null WebSocket = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'tags', -> describe 'tags', ->
TAGS_LIST_KEY = 'hypothesis.user.tags.list' TAGS_LIST_KEY = 'hypothesis.user.tags.list'
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'Threading', -> describe 'Threading', ->
instance = null instance = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
minute = 60 minute = 60
hour = minute * 60 hour = minute * 60
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'unicode', -> describe 'unicode', ->
unicode = null unicode = null
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
poem = poem =
tiger: 'Tiger! Tiger! burning bright tiger: 'Tiger! Tiger! burning bright
......
{module, inject} = require('angular-mock') {module, inject} = angular.mock
describe 'WidgetController', -> describe 'WidgetController', ->
$scope = null $scope = null
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
"annotator": "./h/static/scripts/vendor/annotator.js", "annotator": "./h/static/scripts/vendor/annotator.js",
"annotator-auth": "./h/static/scripts/vendor/annotator.auth.js", "annotator-auth": "./h/static/scripts/vendor/annotator.auth.js",
"angular": "./h/static/scripts/vendor/angular.js", "angular": "./h/static/scripts/vendor/angular.js",
"angular-mock": "./h/static/scripts/vendor/angular-mocks.js",
"dom-anchor-fragment": "./node_modules/dom-anchor-fragment/dist/dom-anchor-fragment.js", "dom-anchor-fragment": "./node_modules/dom-anchor-fragment/dist/dom-anchor-fragment.js",
"dom-anchor-text-position": "./node_modules/dom-anchor-text-position/dist/dom-anchor-text-position.js", "dom-anchor-text-position": "./node_modules/dom-anchor-text-position/dist/dom-anchor-text-position.js",
"dom-anchor-text-quote": "./node_modules/dom-anchor-text-quote/dist/dom-anchor-text-quote.js", "dom-anchor-text-quote": "./node_modules/dom-anchor-text-quote/dist/dom-anchor-text-quote.js",
...@@ -97,7 +96,6 @@ ...@@ -97,7 +96,6 @@
"jquery" "jquery"
] ]
}, },
"angular-mock": "global:angular.mock",
"dom-anchor-fragment": "domAnchorFragment", "dom-anchor-fragment": "domAnchorFragment",
"dom-anchor-text-position": { "dom-anchor-text-position": {
"depends": [ "depends": [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment