Make unwatchPath spec make a valid negative assertion and return the watchId from $native.watchPath

This commit is contained in:
Nathan Sobo
2012-04-25 20:14:35 -06:00
parent 3ac49e1cd5
commit 5c057e11b1
2 changed files with 10 additions and 9 deletions

View File

@@ -296,7 +296,8 @@ bool NativeHandler::Execute(const CefString& name,
context->Exit();
};
[PathWatcher watchPath:path callback:[[callback copy] autorelease]];
NSString *watchId = [PathWatcher watchPath:path callback:[[callback copy] autorelease]];
retval = CefV8Value::CreateString([watchId UTF8String]);
return true;
}

View File

@@ -1,13 +1,13 @@
Directory = require 'directory'
fs = require 'fs'
describe "Directory", ->
fdescribe "Directory", ->
directory = null
beforeEach ->
directory = new Directory(require.resolve('fixtures'))
fdescribe "when the contents of the directory change on disk", ->
describe "when the contents of the directory change on disk", ->
temporaryFilePath = null
beforeEach ->
@@ -33,7 +33,7 @@ describe "Directory", ->
waitsFor "second change", -> changeHandler.callCount > 0
fdescribe "when the directory unsubscribes from events", ->
describe "when the directory unsubscribes from events", ->
temporaryFilePath = null
beforeEach ->
@@ -51,14 +51,14 @@ describe "Directory", ->
directory.on 'contents-change', changeHandler
fs.write(temporaryFilePath, '')
waitsFor "first change", -> changeHandler.callCount > 0
waitsFor "change event", -> changeHandler.callCount > 0
runs ->
changeHandler.reset()
directory.unsubscribeFromNativeChangeEvents()
waits 20
ticks = 0
waitsFor "100 ticks", -> ticks++ < 100
runs -> fs.remove(temporaryFilePath)
waits 20
runs -> expect(changeHandler.callCount).toBe 0
runs ->
expect(changeHandler.callCount).toBe 0