mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Make unwatchPath spec make a valid negative assertion and return the watchId from $native.watchPath
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user