Commit fa6b17e7 authored by Randall Leeds's avatar Randall Leeds

Merge pull request #1998 from hypothesis/move-frontend-tests

Move frontend tests alongside tested modules
parents 81774ae7 262d9e2a
...@@ -19,7 +19,7 @@ describe 'h:AccountController', -> ...@@ -19,7 +19,7 @@ describe 'h:AccountController', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/account/account-controller') require('../account-controller')
beforeEach module('h') beforeEach module('h')
......
...@@ -29,7 +29,7 @@ describe 'h:AuthController', -> ...@@ -29,7 +29,7 @@ describe 'h:AuthController', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/account/auth-controller') require('../auth-controller')
beforeEach module('h') beforeEach module('h')
beforeEach module('h.templates') beforeEach module('h.templates')
......
bb = require('../../../../h/static/scripts/annotator/plugin/bucket-bar') bb = require('../bucket-bar')
assert = chai.assert assert = chai.assert
sinon.assert.expose(assert, prefix: '') sinon.assert.expose(assert, prefix: '')
......
cf = require('../../../../h/static/scripts/annotator/plugin/cross-frame') cf = require('../cross-frame')
assert = chai.assert assert = chai.assert
sinon.assert.expose(assert, prefix: '') sinon.assert.expose(assert, prefix: '')
......
Annotator = require('annotator') Annotator = require('annotator')
ea = require('../../../h/static/scripts/annotator/plugin/enhancedanchoring') ea = require('../enhancedanchoring')
assert = chai.assert assert = chai.assert
sinon.assert.expose(assert, prefix: '') sinon.assert.expose(assert, prefix: '')
......
Annotator = require('annotator') Annotator = require('annotator')
th = require('../../../h/static/scripts/annotator/plugin/texthighlights') th = require('../texthighlights')
assert = chai.assert assert = chai.assert
sinon.assert.expose(assert, prefix: '') sinon.assert.expose(assert, prefix: '')
......
...@@ -25,7 +25,7 @@ describe 'h.directives.annotation', -> ...@@ -25,7 +25,7 @@ describe 'h.directives.annotation', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/directives/annotation') require('../annotation')
beforeEach module('h') beforeEach module('h')
beforeEach module('h.templates') beforeEach module('h.templates')
......
...@@ -16,7 +16,7 @@ describe 'h.directives.privacy', -> ...@@ -16,7 +16,7 @@ describe 'h.directives.privacy', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/directives/privacy') require('../privacy')
beforeEach module('h') beforeEach module('h')
beforeEach module('h.templates') beforeEach module('h.templates')
......
...@@ -12,7 +12,7 @@ describe 'h:directives.simple-search', -> ...@@ -12,7 +12,7 @@ describe 'h:directives.simple-search', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/directives/simple-search') require('../simple-search')
beforeEach module('h') beforeEach module('h')
......
...@@ -10,7 +10,7 @@ describe 'h:directives.status-button', -> ...@@ -10,7 +10,7 @@ describe 'h:directives.status-button', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/directives/status-button') require('../status-button')
beforeEach module('h') beforeEach module('h')
......
...@@ -10,7 +10,7 @@ describe 'h:directives.thread', -> ...@@ -10,7 +10,7 @@ describe 'h:directives.thread', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../../h/static/scripts/directives/thread') require('../thread')
beforeEach module('h') beforeEach module('h')
......
...@@ -12,7 +12,7 @@ describe 'h.helpers:form-helpers', -> ...@@ -12,7 +12,7 @@ describe 'h.helpers:form-helpers', ->
before -> before ->
angular.module('h.helpers', []) angular.module('h.helpers', [])
require('../../../h/static/scripts/helpers/form-helpers') require('../form-helpers')
beforeEach module('h.helpers') beforeEach module('h.helpers')
......
...@@ -9,7 +9,7 @@ describe 'h.helpers:string-helpers', -> ...@@ -9,7 +9,7 @@ describe 'h.helpers:string-helpers', ->
before -> before ->
angular.module('h.helpers', []) angular.module('h.helpers', [])
require('../../../h/static/scripts/helpers/string-helpers') require('../string-helpers')
beforeEach module('h.helpers') beforeEach module('h.helpers')
......
...@@ -44,7 +44,7 @@ describe 'h.helpers:time-helpers', -> ...@@ -44,7 +44,7 @@ describe 'h.helpers:time-helpers', ->
before -> before ->
angular.module('h.helpers', []) angular.module('h.helpers', [])
require('../../../h/static/scripts/helpers/time-helpers') require('../time-helpers')
beforeEach module('h.helpers') beforeEach module('h.helpers')
......
...@@ -12,7 +12,7 @@ describe 'h.session', -> ...@@ -12,7 +12,7 @@ describe 'h.session', ->
before -> before ->
angular.module('h.session', ['ngResource']) angular.module('h.session', ['ngResource'])
require('../../h/static/scripts/session/session-service') require('../session-service')
beforeEach module('h.session') beforeEach module('h.session')
......
...@@ -14,7 +14,7 @@ describe 'AnnotationMapperService', -> ...@@ -14,7 +14,7 @@ describe 'AnnotationMapperService', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/annotation-mapper-service') require('../annotation-mapper-service')
beforeEach module('h') beforeEach module('h')
beforeEach module ($provide) -> beforeEach module ($provide) ->
......
...@@ -15,7 +15,7 @@ describe 'AnnotationSync', -> ...@@ -15,7 +15,7 @@ describe 'AnnotationSync', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/annotation-sync') require('../annotation-sync')
beforeEach module('h') beforeEach module('h')
beforeEach inject (AnnotationSync, $rootScope) -> beforeEach inject (AnnotationSync, $rootScope) ->
......
...@@ -9,7 +9,7 @@ describe 'AnnotationUI', -> ...@@ -9,7 +9,7 @@ describe 'AnnotationUI', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/annotation-ui-service') require('../annotation-ui-service')
beforeEach module('h') beforeEach module('h')
beforeEach inject (_annotationUI_) -> beforeEach inject (_annotationUI_) ->
......
...@@ -18,7 +18,7 @@ describe 'AnnotationUISync', -> ...@@ -18,7 +18,7 @@ describe 'AnnotationUISync', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/annotation-ui-sync') require('../annotation-ui-sync')
beforeEach module('h') beforeEach module('h')
beforeEach inject (AnnotationUISync, $rootScope) -> beforeEach inject (AnnotationUISync, $rootScope) ->
......
...@@ -11,7 +11,7 @@ describe 'h', -> ...@@ -11,7 +11,7 @@ describe 'h', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/auth-service') require('../auth-service')
beforeEach module('h') beforeEach module('h')
......
{module, inject} = require('angular-mock') {module, inject} = require('angular-mock')
Channel = require('../../h/static/scripts/vendor/jschannel.js') Channel = require('../vendor/jschannel.js')
assert = chai.assert assert = chai.assert
sinon.assert.expose assert, prefix: null sinon.assert.expose assert, prefix: null
...@@ -12,7 +12,7 @@ describe 'Bridge', -> ...@@ -12,7 +12,7 @@ describe 'Bridge', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/bridge') require('../bridge')
beforeEach module('h') beforeEach module('h')
beforeEach inject (Bridge) -> beforeEach inject (Bridge) ->
......
...@@ -7,7 +7,7 @@ sinon.assert.expose assert, prefix: null ...@@ -7,7 +7,7 @@ sinon.assert.expose assert, prefix: null
describe 'h:controllers', -> describe 'h:controllers', ->
before -> before ->
angular.module('h', ['ngRoute']) angular.module('h', ['ngRoute'])
require('../../h/static/scripts/controllers') require('../controllers')
describe 'AppController', -> describe 'AppController', ->
$scope = null $scope = null
......
...@@ -19,7 +19,7 @@ describe 'CrossFrameService', -> ...@@ -19,7 +19,7 @@ describe 'CrossFrameService', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/cross-frame-service') require('../cross-frame-service')
beforeEach module('h') beforeEach module('h')
beforeEach module ($provide) -> beforeEach module ($provide) ->
......
...@@ -6,7 +6,7 @@ assert = chai.assert ...@@ -6,7 +6,7 @@ assert = chai.assert
describe 'h:directives', -> describe 'h:directives', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/directives') require('../directives')
beforeEach module('h') beforeEach module('h')
......
...@@ -12,7 +12,7 @@ describe 'Discovery', -> ...@@ -12,7 +12,7 @@ describe 'Discovery', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/discovery') require('../discovery')
beforeEach module('h') beforeEach module('h')
beforeEach inject (Discovery) -> beforeEach inject (Discovery) ->
......
...@@ -7,7 +7,7 @@ describe 'h:filters', -> ...@@ -7,7 +7,7 @@ describe 'h:filters', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/filters') require('../filters')
describe 'persona', -> describe 'persona', ->
filter = null filter = null
......
Annotator = require('annotator') Annotator = require('annotator')
Guest = require('../../h/static/scripts/guest') Guest = require('../guest')
assert = chai.assert assert = chai.assert
sinon.assert.expose(assert, prefix: '') sinon.assert.expose(assert, prefix: '')
......
Annotator = require('annotator') Annotator = require('annotator')
Host = require('../../h/static/scripts/host') Host = require('../host')
assert = chai.assert assert = chai.assert
sinon.assert.expose(assert, prefix: '') sinon.assert.expose(assert, prefix: '')
......
...@@ -10,7 +10,7 @@ describe 'h.identity', -> ...@@ -10,7 +10,7 @@ describe 'h.identity', ->
mockInjectable = {} mockInjectable = {}
before -> before ->
require('../../h/static/scripts/identity-service') require('../identity-service')
beforeEach module('h.identity') beforeEach module('h.identity')
......
...@@ -10,7 +10,7 @@ describe 'h:permissions', -> ...@@ -10,7 +10,7 @@ describe 'h:permissions', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/permissions-service') require('../permissions-service')
beforeEach module('h') beforeEach module('h')
......
...@@ -22,7 +22,7 @@ describe 'h:services', -> ...@@ -22,7 +22,7 @@ describe 'h:services', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/services') require('../services')
beforeEach module('h') beforeEach module('h')
......
...@@ -12,7 +12,7 @@ describe 'store', -> ...@@ -12,7 +12,7 @@ describe 'store', ->
before -> before ->
angular.module('h', ['ngResource']) angular.module('h', ['ngResource'])
require('../../h/static/scripts/store-service') require('../store-service')
beforeEach module('h') beforeEach module('h')
......
...@@ -12,7 +12,7 @@ describe 'streamer', -> ...@@ -12,7 +12,7 @@ describe 'streamer', ->
sandbox = null sandbox = null
before -> before ->
require('../../h/static/scripts/streamer-service') require('../streamer-service')
beforeEach module('h.streamer') beforeEach module('h.streamer')
......
...@@ -9,7 +9,7 @@ describe 'Threading', -> ...@@ -9,7 +9,7 @@ describe 'Threading', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
require('../../h/static/scripts/threading-service') require('../threading-service')
beforeEach module('h') beforeEach module('h')
......
// Karma configuration // Karma configuration
// Generated on Mon Jul 14 2014 14:06:50 GMT+0200 (CEST) // Generated on Mon Jul 14 2014 14:06:50 GMT+0200 (CEST)
var path = require('path');
module.exports = function(config) { module.exports = function(config) {
config.set({ config.set({
// base path that will be used to resolve all patterns (eg. files, exclude) // base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '', basePath: 'h/static/scripts',
// frameworks to use // frameworks to use
...@@ -19,34 +20,34 @@ module.exports = function(config) { ...@@ -19,34 +20,34 @@ module.exports = function(config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
// Application external deps // Application external deps
'h/static/scripts/vendor/jquery.js', 'vendor/jquery.js',
'h/static/scripts/vendor/angular.js', 'vendor/angular.js',
'h/static/scripts/vendor/angular-animate.js', 'vendor/angular-animate.js',
'h/static/scripts/vendor/angular-bootstrap.js', 'vendor/angular-bootstrap.js',
'h/static/scripts/vendor/angular-resource.js', 'vendor/angular-resource.js',
'h/static/scripts/vendor/angular-route.js', 'vendor/angular-route.js',
'h/static/scripts/vendor/angular-sanitize.js', 'vendor/angular-sanitize.js',
'h/static/scripts/vendor/ng-tags-input.js', 'vendor/ng-tags-input.js',
'h/static/scripts/vendor/annotator.js', 'vendor/annotator.js',
'h/static/scripts/vendor/polyfills/autofill-event.js', 'vendor/polyfills/autofill-event.js',
'h/static/scripts/vendor/polyfills/bind.js', 'vendor/polyfills/bind.js',
'h/static/scripts/vendor/katex/katex.js', 'vendor/katex/katex.js',
'h/static/scripts/vendor/moment-with-langs.js', 'vendor/moment-with-langs.js',
'h/static/scripts/vendor/jstz.js', 'vendor/jstz.js',
'h/static/scripts/vendor/moment-timezone.js', 'vendor/moment-timezone.js',
'h/static/scripts/vendor/moment-timezone-data.js', 'vendor/moment-timezone-data.js',
'h/static/scripts/vendor/polyfills/url.js', 'vendor/polyfills/url.js',
// Test deps // Test deps
'h/static/scripts/vendor/angular-mocks.js', 'vendor/angular-mocks.js',
'h/static/scripts/vendor/polyfills/promise.js', 'vendor/polyfills/promise.js',
'h/static/scripts/vendor/sinon.js', 'vendor/sinon.js',
'h/static/scripts/vendor/chai.js', 'vendor/chai.js',
'h/templates/client/*.html', '../../templates/client/*.html',
'tests/js/bootstrap.coffee', 'test/bootstrap.coffee',
// Tests // Tests
'tests/js/**/*-test.coffee', '**/*-test.coffee'
], ],
...@@ -57,14 +58,14 @@ module.exports = function(config) { ...@@ -57,14 +58,14 @@ module.exports = function(config) {
// strip templates of leading path // strip templates of leading path
ngHtml2JsPreprocessor: { ngHtml2JsPreprocessor: {
moduleName: 'h.templates', moduleName: 'h.templates',
stripPrefix: 'h/templates/client/' cacheIdFromPath: path.basename
}, },
// preprocess matching files before serving them to the browser // preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: { preprocessors: {
'**/*.coffee': ['browserify'], '**/*.coffee': ['browserify'],
'h/templates/client/*.html': ['ng-html2js'], '../../templates/client/*.html': ['ng-html2js'],
}, },
browserify: { browserify: {
......
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