Unverified Commit d5e27673 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #852 from hypothesis/dependabot/npm_and_yarn/mocha-5.2.0

Bump mocha from 2.5.3 to 5.2.0
parents f7a22613 e57a929a
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
"lodash.debounce": "^4.0.3", "lodash.debounce": "^4.0.3",
"lodash.get": "^4.3.0", "lodash.get": "^4.3.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mocha": "^2.4.5", "mocha": "^5.2.0",
"ng-tags-input": "^3.1.1", "ng-tags-input": "^3.1.1",
"node-uuid": "^1.4.3", "node-uuid": "^1.4.3",
"npm-packlist": "^1.1.12", "npm-packlist": "^1.1.12",
......
...@@ -549,44 +549,41 @@ describe 'Guest', -> ...@@ -549,44 +549,41 @@ describe 'Guest', ->
guest.anchor(annotation).then -> guest.anchor(annotation).then ->
assert.notCalled(anchoring.anchor) assert.notCalled(anchoring.anchor)
it 'updates the cross frame and bucket bar plugins', (done) -> it 'updates the cross frame and bucket bar plugins', () ->
guest = createGuest() guest = createGuest()
guest.plugins.CrossFrame = guest.plugins.CrossFrame =
sync: sinon.stub() sync: sinon.stub()
guest.plugins.BucketBar = guest.plugins.BucketBar =
update: sinon.stub() update: sinon.stub()
annotation = {} annotation = {}
guest.anchor(annotation).then -> return guest.anchor(annotation).then ->
assert.called(guest.plugins.BucketBar.update) assert.called(guest.plugins.BucketBar.update)
assert.called(guest.plugins.CrossFrame.sync) assert.called(guest.plugins.CrossFrame.sync)
.then(done, done)
it 'returns a promise of the anchors for the annotation', (done) -> it 'returns a promise of the anchors for the annotation', () ->
guest = createGuest() guest = createGuest()
highlights = [document.createElement('span')] highlights = [document.createElement('span')]
sandbox.stub(anchoring, 'anchor').returns(Promise.resolve(range)) sandbox.stub(anchoring, 'anchor').returns(Promise.resolve(range))
sandbox.stub(highlighter, 'highlightRange').returns(highlights) sandbox.stub(highlighter, 'highlightRange').returns(highlights)
target = {selector: [{type: 'TextQuoteSelector', exact: 'hello'}]} target = {selector: [{type: 'TextQuoteSelector', exact: 'hello'}]}
guest.anchor({target: [target]}).then (anchors) -> return guest.anchor({target: [target]}).then (anchors) ->
assert.equal(anchors.length, 1) assert.equal(anchors.length, 1)
.then(done, done)
it 'adds the anchor to the "anchors" instance property"', (done) -> it 'adds the anchor to the "anchors" instance property"', () ->
guest = createGuest() guest = createGuest()
highlights = [document.createElement('span')] highlights = [document.createElement('span')]
sandbox.stub(anchoring, 'anchor').returns(Promise.resolve(range)) sandbox.stub(anchoring, 'anchor').returns(Promise.resolve(range))
sandbox.stub(highlighter, 'highlightRange').returns(highlights) sandbox.stub(highlighter, 'highlightRange').returns(highlights)
target = {selector: [{type: 'TextQuoteSelector', exact: 'hello'}]} target = {selector: [{type: 'TextQuoteSelector', exact: 'hello'}]}
annotation = {target: [target]} annotation = {target: [target]}
guest.anchor(annotation).then -> return guest.anchor(annotation).then ->
assert.equal(guest.anchors.length, 1) assert.equal(guest.anchors.length, 1)
assert.strictEqual(guest.anchors[0].annotation, annotation) assert.strictEqual(guest.anchors[0].annotation, annotation)
assert.strictEqual(guest.anchors[0].target, target) assert.strictEqual(guest.anchors[0].target, target)
assert.strictEqual(guest.anchors[0].range, range) assert.strictEqual(guest.anchors[0].range, range)
assert.strictEqual(guest.anchors[0].highlights, highlights) assert.strictEqual(guest.anchors[0].highlights, highlights)
.then(done, done)
it 'destroys targets that have been removed from the annotation', (done) -> it 'destroys targets that have been removed from the annotation', () ->
annotation = {} annotation = {}
target = {} target = {}
highlights = [] highlights = []
...@@ -594,21 +591,19 @@ describe 'Guest', -> ...@@ -594,21 +591,19 @@ describe 'Guest', ->
guest.anchors = [{annotation, target, highlights}] guest.anchors = [{annotation, target, highlights}]
removeHighlights = sandbox.stub(highlighter, 'removeHighlights') removeHighlights = sandbox.stub(highlighter, 'removeHighlights')
guest.anchor(annotation).then -> return guest.anchor(annotation).then ->
assert.equal(guest.anchors.length, 0) assert.equal(guest.anchors.length, 0)
assert.calledOnce(removeHighlights) assert.calledOnce(removeHighlights)
assert.calledWith(removeHighlights, highlights) assert.calledWith(removeHighlights, highlights)
.then(done, done)
it 'does not reanchor targets that are already anchored', (done) -> it 'does not reanchor targets that are already anchored', () ->
guest = createGuest() guest = createGuest()
annotation = target: [{selector: [{type: 'TextQuoteSelector', exact: 'hello'}]}] annotation = target: [{selector: [{type: 'TextQuoteSelector', exact: 'hello'}]}]
stub = sandbox.stub(anchoring, 'anchor').returns(Promise.resolve(range)) stub = sandbox.stub(anchoring, 'anchor').returns(Promise.resolve(range))
guest.anchor(annotation).then -> return guest.anchor(annotation).then ->
guest.anchor(annotation).then -> guest.anchor(annotation).then ->
assert.equal(guest.anchors.length, 1) assert.equal(guest.anchors.length, 1)
assert.calledOnce(stub) assert.calledOnce(stub)
.then(done, done)
describe '#detach()', -> describe '#detach()', ->
it 'removes the anchors from the "anchors" instance variable', -> it 'removes the anchors from the "anchors" instance variable', ->
......
This diff is collapsed.
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