Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
hypothesis/h
40a/h
AFDudley/h
BigBlueHat/h
BinaryStars/h
CCH543/h
Cinemacloud/h
Ericgood/h
FTG-003/h
Forethinker/h
GratefulTony/h
HGldJ1966/h
JJediny/h
John-Williams/h
Laurian/h
LittleFancy/h
MattyQ/h
Mishkin2015/h
RichardLitt/h
Staffan1/h
SteelWagstaff/h
TowerBR/h
VanyTang/h
abigailricarte/h
ackermann/h
alecchap/h
alesarrett/h
alexsegura/h
almereyda/h
alon/h
andzi/h
angelicxsoul/h
ansmoh/h
apurvajalit/h
arjunvasan/h
asdevor/h
bZichett/h
badgettrg/Webmarks
balmas/h
balupton/h
bbarker/h
bennlich/h
benthor/h
blakewest/h
bogste/h
bradparks/h
brittanystoroz/h
buiquangchien/h
cdchapman/h
charblanc/h
chowsamihq/h
chr7stos/Webmarks
chrber/h
chrismPssina/h
christinaphamAD/h
cmbirk/h
codeaudit/h
coolcool21/h
cove/h
csillag/h
danjimilk/h
dannyhope/h
daredream/h
davidmcclure/h
dennisplucinik/h
dezynetechnologies/h
diegodlh/h
djcun95/h
donsequitur/h
edsu/h
eiro10/h
emckean/h
ercchy/h
eshellman/h
fangang123/h
fchasen/h
fcrimins/h
fhirsch/h
ficolo/h
fragkopoulos/h
gauravkeerthi/h
geass/h
gergely-ujvari/h
gitter-badger/h
gnott/h
gobengo/h
gorinovic/h
gus3000/h
hashin/h
helemaalbigt/h
hmstepanek/h
hwasiti/h
hylhero/h
hyperstudio/h
iHDeveloper/h
imeysam/h
jackspaceBerkeley/h
jarey/h
jasdeep/h
jason790/h
jasonzou/j
jazahn/h
jccr/h
jean/h
jeka57/h
jeremydean/h
jermnelson/h
jibe-b/h
jnishiyama/h
jojksd/h
jpadilla/h
jtremback/h
judell/h
juli-so/h
kabacs/h
karissa/h
kaushikvijay/h
kaydoh/h
kill4uk/h
klopiinas/h
klrkdekira/h
koulihong311/h
krassif/h
krstnkngs/h
leoqmp/h
linhua55/h
lucadealfaro/h
lyspooner/h
lyzadanger/h
m1yag1/h
magee/h
mambocab/h
manunymous/h
maraino/h
mari-ja/h
markbarratt/h
martinq/h
mbbaig/h
mcarv63/h
meawoppl/h
meflyup/h
metasj/h
mgasner/h
mgax/h
mollycr/h
mrchrisadams/h
mrienstra/h
mshavlovsky/h
muddasani/h
nagyist/hyphothesis-h
nagyistoce/hypothesis-h
nanxio/h
neozhangthe1/h
ningyifan/h
nkingsley/h
nlholdem/h
nlisgo/h
noscripter/h
nshkuro/h
odnodn/h
oliversauter/h
openbizgit/h
opengovfoundation/h
openstax/hypothesis-server
ouroboros8/h
pablomarti/h
pamo/h
philipn/h
philschatz/h
pinballwonder/h
plainspace/h
raowl/h
rickyhan/h
rmoorman/h
rmtsukuru/h
robertknight/h
rowhit/h
rsarxiv/h
saakaifoundry/h
samrose/h
scharf/h
shepazu/h
sherah/h
shofheinz/h
soapdog/h
ssin122/test-h
st-fresh/h
stuk88/h
sylvanmist/h
tetratorus/h
tilgovi/h
tomnar/h
trivenews/h
truthadjustr/h
utngz/h
voidfiles/h
wenchen/h
yargevad/h
yumatch/h
zshen777/h
Nothing to show
Choose a Head Repository
hypothesis/h
40a/h
AFDudley/h
BigBlueHat/h
BinaryStars/h
CCH543/h
Cinemacloud/h
Ericgood/h
FTG-003/h
Forethinker/h
GratefulTony/h
HGldJ1966/h
JJediny/h
John-Williams/h
Laurian/h
LittleFancy/h
MattyQ/h
Mishkin2015/h
RichardLitt/h
Staffan1/h
SteelWagstaff/h
TowerBR/h
VanyTang/h
abigailricarte/h
ackermann/h
alecchap/h
alesarrett/h
alexsegura/h
almereyda/h
alon/h
andzi/h
angelicxsoul/h
ansmoh/h
apurvajalit/h
arjunvasan/h
asdevor/h
bZichett/h
badgettrg/Webmarks
balmas/h
balupton/h
bbarker/h
bennlich/h
benthor/h
blakewest/h
bogste/h
bradparks/h
brittanystoroz/h
buiquangchien/h
cdchapman/h
charblanc/h
chowsamihq/h
chr7stos/Webmarks
chrber/h
chrismPssina/h
christinaphamAD/h
cmbirk/h
codeaudit/h
coolcool21/h
cove/h
csillag/h
danjimilk/h
dannyhope/h
daredream/h
davidmcclure/h
dennisplucinik/h
dezynetechnologies/h
diegodlh/h
djcun95/h
donsequitur/h
edsu/h
eiro10/h
emckean/h
ercchy/h
eshellman/h
fangang123/h
fchasen/h
fcrimins/h
fhirsch/h
ficolo/h
fragkopoulos/h
gauravkeerthi/h
geass/h
gergely-ujvari/h
gitter-badger/h
gnott/h
gobengo/h
gorinovic/h
gus3000/h
hashin/h
helemaalbigt/h
hmstepanek/h
hwasiti/h
hylhero/h
hyperstudio/h
iHDeveloper/h
imeysam/h
jackspaceBerkeley/h
jarey/h
jasdeep/h
jason790/h
jasonzou/j
jazahn/h
jccr/h
jean/h
jeka57/h
jeremydean/h
jermnelson/h
jibe-b/h
jnishiyama/h
jojksd/h
jpadilla/h
jtremback/h
judell/h
juli-so/h
kabacs/h
karissa/h
kaushikvijay/h
kaydoh/h
kill4uk/h
klopiinas/h
klrkdekira/h
koulihong311/h
krassif/h
krstnkngs/h
leoqmp/h
linhua55/h
lucadealfaro/h
lyspooner/h
lyzadanger/h
m1yag1/h
magee/h
mambocab/h
manunymous/h
maraino/h
mari-ja/h
markbarratt/h
martinq/h
mbbaig/h
mcarv63/h
meawoppl/h
meflyup/h
metasj/h
mgasner/h
mgax/h
mollycr/h
mrchrisadams/h
mrienstra/h
mshavlovsky/h
muddasani/h
nagyist/hyphothesis-h
nagyistoce/hypothesis-h
nanxio/h
neozhangthe1/h
ningyifan/h
nkingsley/h
nlholdem/h
nlisgo/h
noscripter/h
nshkuro/h
odnodn/h
oliversauter/h
openbizgit/h
opengovfoundation/h
openstax/hypothesis-server
ouroboros8/h
pablomarti/h
pamo/h
philipn/h
philschatz/h
pinballwonder/h
plainspace/h
raowl/h
rickyhan/h
rmoorman/h
rmtsukuru/h
robertknight/h
rowhit/h
rsarxiv/h
saakaifoundry/h
samrose/h
scharf/h
shepazu/h
sherah/h
shofheinz/h
soapdog/h
ssin122/test-h
st-fresh/h
stuk88/h
sylvanmist/h
tetratorus/h
tilgovi/h
tomnar/h
trivenews/h
truthadjustr/h
utngz/h
voidfiles/h
wenchen/h
yargevad/h
yumatch/h
zshen777/h
Nothing to show
  • 2 commits
  • 46 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 25, 2015
Browserify the test harness
Use karma-browserify to run the tests, rather than relying on prebuilt
assets. This commit alters our test harness so that it no longer relies
(at all) on the webassets pipeline. This means:

- test isolation is improved, as each test file runs in its own module
- bringing objects into test scope is now simply a matter of requiring
  the correct module, rather than bolting more and more objects onto the
  Annotator namespace
- autoreloading of tests when either test files or their dependencies
  are modified is now possible (and enabled by default)
Showing with 1,191 additions and 925 deletions.
  1. +0 −1 Makefile
  2. +2 −5 README.rst
  3. +44 −2 h/static/bootstrap.js
  4. +4 −0 h/static/scripts/annotator/plugin/bucket-bar.coffee
  5. +4 −0 h/static/scripts/annotator/plugin/cross-frame.coffee
  6. +2 −0 h/static/scripts/annotator/plugin/enhancedanchoring.coffee
  7. +4 −0 h/static/scripts/annotator/plugin/texthighlights.coffee
  8. +4 −4 h/static/scripts/controllers.coffee
  9. +0 −42 h/static/scripts/guest.coffee
  10. +27 −32 karma.config.js
  11. +4 −2 package.json
  12. +13 −2 tests/js/account/account-controller-test.coffee
  13. +7 −1 tests/js/account/auth-controller-test.coffee
  14. +7 −0 tests/js/annotation-mapper-service-test.coffee
  15. +7 −0 tests/js/annotation-sync-test.coffee
  16. +7 −0 tests/js/annotation-ui-service-test.coffee
  17. +7 −0 tests/js/annotation-ui-sync-test.coffee
  18. +3 −1 tests/js/annotator/plugins/bucket-bar-test.coffee
  19. +13 −17 tests/js/annotator/plugins/cross-frame-test.coffee
  20. +7 −0 tests/js/auth-service-test.coffee
  21. +8 −0 tests/js/bridge-test.coffee
  22. +305 −235 tests/js/controllers-test.coffee
  23. +7 −0 tests/js/cross-frame-service-test.coffee
  24. +12 −128 tests/js/directives-test.coffee
  25. +57 −30 tests/js/directives/annotation-test.coffee
  26. +65 −96 tests/js/directives/privacy-test.coffee
  27. +66 −61 tests/js/directives/simple-search-test.coffee
  28. +8 −1 tests/js/directives/status-button-test.coffee
  29. +152 −140 tests/js/directives/thread-test.coffee
  30. +7 −0 tests/js/discovery-test.coffee
  31. +35 −27 tests/js/filters-test.coffee
  32. +29 −10 tests/js/guest-test.coffee
  33. +156 −0 tests/js/helpers/form-helpers-test.coffee
  34. +8 −1 tests/js/helpers/string-helpers-test.coffee
  35. +9 −2 tests/js/helpers/time-helpers-test.coffee
  36. +4 −1 tests/js/host-test.coffee
  37. +7 −1 tests/js/identity-service-test.coffee
  38. +8 −1 tests/js/permissions-service-test.coffee
  39. +11 −12 tests/js/plugin/enhancedanchoring-test.coffee
  40. +6 −9 tests/js/plugin/texthighlight-test.coffee
  41. +17 −6 tests/js/services-test.coffee
  42. +26 −11 tests/js/session-service-test.coffee
  43. +7 −0 tests/js/store-service-test.coffee
  44. +8 −1 tests/js/streamer-service-test.coffee
  45. +7 −0 tests/js/threading-service-test.coffee
  46. +0 −43 tests/js/util-test.coffee
View
@@ -20,7 +20,6 @@ test:
$(eval es := $(shell wget --quiet --output-document - http://localhost:9200))
@if [ -n '${es}' ] ; then echo "yes." ; else echo "no!"; exit 1; fi
python setup.py develop test
hypothesis assets development.ini
"$$(npm bin)"/karma start karma.config.js --single-run
"$$(npm bin)"/karma start h/browser/chrome/karma.config.js --single-run
View
@@ -107,10 +107,8 @@ To run the Python suite, invoke the tests in the standard fashion::
$ ./bin/python setup.py test
To run the JavaScript suite, ensure the assets are built and then invoke the
karma test runner::
To run the JavaScript suite, run::
$ hypothesis assets development.ini
$ $(npm bin)/karma start karma.config.js --single-run
As a convenience, there is a make target which will do all of the above::
@@ -120,8 +118,7 @@ As a convenience, there is a make target which will do all of the above::
It's also possible to run a subset of the tests using ``karma run``::
$ $(npm bin)/karma start karma.config.js & # Start the server in the bg.
$ hypothesis assets development.ini && \
$(npm bin)/karma run karma.config.js -- --grep={FILTER_STRING}
$ $(npm bin)/karma run karma.config.js -- --grep={FILTER_STRING}
This will run generally be much faster than running ``karma start --single-run``
each time. The frontend tests can also be debugged by visiting
View
@@ -1,6 +1,48 @@
require('./scripts/vendor/jquery.scrollintoview');
var Annotator = require('annotator');
// Monkeypatch annotator!
require('./scripts/annotator/monkey');
// Cross-frame communication
require('./scripts/annotator/plugin/cross-frame');
require('./scripts/annotation-sync');
require('./scripts/bridge');
require('./scripts/discovery');
// Document plugin
require('./scripts/vendor/annotator.document');
// Bucket bar
require('./scripts/annotator/plugin/bucket-bar');
// Toolbar
require('./scripts/annotator/plugin/toolbar');
// Drawing highlights
require('./scripts/annotator/plugin/texthighlights');
// Creating selections
require('./scripts/annotator/plugin/textselection');
// URL fragments
require('./scripts/annotator/plugin/fragmentselector');
// Anchoring
require('./scripts/vendor/dom_text_mapper');
require('./scripts/annotator/plugin/enhancedanchoring');
require('./scripts/annotator/plugin/domtextmapper');
require('./scripts/annotator/plugin/textposition');
require('./scripts/annotator/plugin/textquote');
require('./scripts/annotator/plugin/textrange');
// PDF
require('./scripts/vendor/page_text_mapper_core');
require('./scripts/annotator/plugin/pdf');
// Fuzzy
require('./scripts/vendor/dom_text_matcher');
require('./scripts/annotator/plugin/fuzzytextanchors');
var Klass = require('./scripts/host');
var docs = 'https://github.com/hypothesis/h/blob/master/README.rst#customized-embedding';
var options = {
@@ -1,3 +1,5 @@
Annotator = require('annotator')
$ = Annotator.$
class Annotator.Plugin.BucketBar extends Annotator.Plugin
@@ -338,3 +340,5 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
isUpper: (i) -> i == 1
isLower: (i) -> i == @index.length - 2
exports.BucketBar = Annotator.Plugin.BucketBar
@@ -1,3 +1,5 @@
Annotator = require('annotator')
$ = Annotator.$
# Extracts individual keys from an object and returns a new one.
@@ -45,3 +47,5 @@ CrossFrame = class Annotator.Plugin.CrossFrame extends Annotator.Plugin
this.onConnect = (fn) ->
bridge.onConnect(fn)
exports.CrossFrame = CrossFrame
@@ -293,3 +293,5 @@ class Annotator.Plugin.EnhancedAnchoring extends Annotator.Plugin
selectors
exports.Anchor = Anchor
exports.EnhancedAnchoring = Annotator.Plugin.EnhancedAnchoring
@@ -1,3 +1,5 @@
require('../../vendor/jquery.scrollintoview')
$ = Annotator.$
# Public: Wraps the DOM Nodes within the provided range with a highlight
@@ -125,3 +127,5 @@ class Annotator.Plugin.TextHighlights extends Annotator.Plugin
pluginInit: ->
# Export the text highlight class for other plugins
Annotator.TextHighlight = TextHighlight
exports.TextHighlight = TextHighlight
@@ -22,13 +22,13 @@ class AppController
this.$inject = [
'$controller', '$document', '$location', '$route', '$scope', '$window',
'auth', 'drafts', 'identity',
'permissions', 'streamer', 'streamfilter', 'annotationUI',
'permissions', 'streamer', 'annotationUI',
'annotationMapper', 'threading'
]
constructor: (
$controller, $document, $location, $route, $scope, $window,
auth, drafts, identity,
permissions, streamer, streamfilter, annotationUI,
permissions, streamer, annotationUI,
annotationMapper, threading
) ->
$controller(AnnotationUIController, {$scope})
@@ -176,11 +176,11 @@ class AnnotationViewerController
class ViewerController
this.$inject = [
'$scope', '$route', 'annotationUI', 'crossframe', 'annotationMapper',
'auth', 'flash', 'streamer', 'streamfilter', 'store'
'auth', 'streamer', 'streamfilter', 'store'
]
constructor: (
$scope, $route, annotationUI, crossframe, annotationMapper,
auth, flash, streamer, streamfilter, store
auth, streamer, streamfilter, store
) ->
# Tells the view that these annotations are embedded into the owner doc
$scope.isEmbedded = true
@@ -2,48 +2,6 @@ $ = require('jquery')
Annotator = require('annotator')
Channel = require('./vendor/jschannel')
# Monkeypatch annotator!
require('./annotator/monkey')
# Cross-frame communication
require('./annotator/plugin/cross-frame')
require('./annotation-sync')
require('./bridge')
require('./discovery')
# Document plugin
require('./vendor/annotator.document')
# Bucket bar
require('./annotator/plugin/bucket-bar')
# Toolbar
require('./annotator/plugin/toolbar')
# Drawing highlights
require('./annotator/plugin/texthighlights')
# Creating selections
require('./annotator/plugin/textselection')
# URL fragments
require('./annotator/plugin/fragmentselector')
# Anchoring
require('./vendor/dom_text_mapper')
require('./annotator/plugin/enhancedanchoring')
require('./annotator/plugin/domtextmapper')
require('./annotator/plugin/textposition')
require('./annotator/plugin/textquote')
require('./annotator/plugin/textrange')
# PDF
require('./vendor/page_text_mapper_core')
require('./annotator/plugin/pdf')
# Fuzzy
require('./vendor/dom_text_matcher')
require('./annotator/plugin/fuzzytextanchors')
module.exports = class Annotator.Guest extends Annotator
SHOW_HIGHLIGHTS_CLASS = 'annotator-highlights-always-on'
View
@@ -10,52 +10,43 @@ module.exports = function(config) {
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
frameworks: [
'browserify',
'mocha'
],
// list of files / patterns to load in the browser
files: [
'h/static/scripts/vendor/polyfills/bind.js',
'h/static/scripts/vendor/polyfills/url.js',
'h/static/scripts/vendor/polyfills/promise.js',
// Application external deps
'h/static/scripts/vendor/jquery.js',
'h/static/scripts/vendor/jschannel.js',
'h/static/scripts/vendor/jwz.js',
'h/static/scripts/vendor/moment-with-langs.js',
'h/static/scripts/vendor/jstz.js',
'h/static/scripts/vendor/moment-timezone.js',
'h/static/scripts/vendor/moment-timezone-data.js',
'h/static/scripts/vendor/Markdown.Converter.js',
'h/static/scripts/vendor/unorm.js',
'h/static/scripts/vendor/uuid.js',
'h/static/scripts/vendor/annotator.js',
'h/static/scripts/annotator/monkey.js',
'h/static/scripts/vendor/annotator.auth.js',
'h/static/scripts/annotator/plugin/bridge.js',
'h/static/scripts/annotator/plugin/bucket-bar.js',
'h/static/scripts/vendor/dom_text_mapper.js',
'h/static/scripts/annotator/annotator.anchoring.js',
// Angular needs to be included after annotator to avoid the
// CrossFrame dependencies in Bridge picking up the angular object.
'h/static/scripts/vendor/angular.js',
'h/static/scripts/vendor/angular-mocks.js',
'h/static/scripts/vendor/angular-animate.js',
'h/static/scripts/vendor/angular-bootstrap.js',
'h/static/scripts/vendor/angular-resource.js',
'h/static/scripts/vendor/angular-route.js',
'h/static/scripts/vendor/angular-sanitize.js',
'h/static/scripts/vendor/ng-tags-input.js',
'h/static/scripts/annotator/plugin/texthighlights.js',
'h/static/scripts/app.js',
'h/static/scripts/account.js',
'h/static/scripts/helpers.js',
'h/static/scripts/session.js',
'h/static/scripts/hypothesis.js',
'h/static/scripts/vendor/annotator.js',
'h/static/scripts/vendor/polyfills/autofill-event.js',
'h/static/scripts/vendor/polyfills/bind.js',
'h/static/scripts/vendor/katex/katex.js',
'h/static/scripts/vendor/moment-with-langs.js',
'h/static/scripts/vendor/jstz.js',
'h/static/scripts/vendor/moment-timezone.js',
'h/static/scripts/vendor/moment-timezone-data.js',
'h/static/scripts/vendor/polyfills/url.js',
// Test deps
'h/static/scripts/vendor/angular-mocks.js',
'h/static/scripts/vendor/polyfills/promise.js',
'h/static/scripts/vendor/sinon.js',
'h/static/scripts/vendor/chai.js',
'h/templates/client/*.html',
'tests/js/bootstrap.coffee',
'tests/js/**/*-test.coffee'
// Tests
'tests/js/**/*-test.coffee',
],
@@ -72,10 +63,14 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'**/*.coffee': ['coffee'],
'**/*.coffee': ['browserify'],
'h/templates/client/*.html': ['ng-html2js'],
},
browserify: {
debug: true,
extensions: ['.coffee']
},
// test results reporter to use
// possible values: 'dots', 'progress'
@@ -97,7 +92,7 @@ module.exports = function(config) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
autoWatch: true,
// start these browsers
View
@@ -13,8 +13,8 @@
},
"devDependencies": {
"karma": "^0.12.17",
"karma-browserify": "^3.0.3",
"karma-cli": "0.0.4",
"karma-coffee-preprocessor": "^0.2.1",
"karma-mocha": "^0.1.4",
"karma-ng-html2js-preprocessor": "^0.1.0",
"karma-phantomjs-launcher": "^0.1.4",
@@ -42,12 +42,14 @@
"browser": {
"jquery": "./h/static/scripts/vendor/jquery.js",
"annotator": "./h/static/scripts/vendor/annotator.js",
"angular": "./h/static/scripts/vendor/angular.js"
"angular": "./h/static/scripts/vendor/angular.js",
"angular-mock": "./h/static/scripts/vendor/angular-mocks.js"
},
"browserify-shim": {
"jquery": "global:jQuery",
"annotator": "global:Annotator",
"angular": "global:angular",
"angular-mock": "global:angular.mock",
"./h/static/scripts/vendor/jschannel.js": "Channel",
"./h/static/scripts/vendor/page_text_mapper_core.js": "PageTextMapperCore",
"./h/static/scripts/vendor/dom_text_matcher.js": {
@@ -1,8 +1,10 @@
{inject, module} = require('angular-mock')
assert = chai.assert
sinon.assert.expose assert, prefix: null
sandbox = sinon.sandbox.create()
describe 'AccountController', ->
describe 'h:AccountController', ->
$scope = null
fakeFlash = null
fakeSession = null
@@ -13,10 +15,16 @@ describe 'AccountController', ->
disableUserPromise = null
profilePromise = null
createController = null
sandbox = null
before ->
angular.module('h', [])
require('../../../h/static/scripts/account/account-controller')
beforeEach module('h')
beforeEach module ($provide, $filterProvider) ->
sandbox = sinon.sandbox.create()
fakeSession = {}
fakeFlash = sandbox.spy()
fakeIdentity =
@@ -49,6 +57,9 @@ describe 'AccountController', ->
createController = ->
$controller('AccountController', {$scope: $scope})
afterEach ->
sandbox.restore()
describe '.submit', ->
createFakeForm = (overrides={}) ->
defaults =
@@ -1,3 +1,5 @@
{inject, module} = require('angular-mock')
assert = chai.assert
sinon.assert.expose assert, prefix: null
sandbox = sinon.sandbox.create()
@@ -19,12 +21,16 @@ class MockSession
mockFlash = sandbox.spy()
mockFormHelpers = applyValidationErrors: sandbox.spy()
describe 'AuthController', ->
describe 'h:AuthController', ->
$scope = null
$timeout = null
auth = null
session = null
before ->
angular.module('h', [])
require('../../../h/static/scripts/account/auth-controller')
beforeEach module('h')
beforeEach module('h.templates')
Oops, something went wrong.

No commit comments for this range