type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
FunctionDeclaration
function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return Promise.resolve().then(getBinary)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["__indirect_function_table"];removeRunDependency("wasm-instantiate")}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function receiveInstantiatedSource(output){receiveInstance(output["instance"])}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function demangle(func){return func}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function dynCallLegacy(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}return Module["dynCall_"+sig].call(null,ptr)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function getRandomDevice(){if(typeof crypto==="object"&&typeof crypto["getRandomValues"]==="function"){var randomBuffer=new Uint8Array(1);return function(){crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return function(){return crypto_module["randomBytes"](1)[0]}}catch(e){}}return function(){abort("randomDevice")}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function mmapAlloc(size){var alignedSize=alignMemory(size,16384);var ptr=_malloc(alignedSize);while(size<alignedSize)HEAP8[ptr+size++]=0;return ptr}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}var handled=false;Module["preloadPlugins"].forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,function(){if(onerror)onerror();removeRunDependency(dep)});handled=true}});if(!handled)finish(byteArray)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function finish(){if(fail==0)onload();else onerror()}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd);if(size<cwdLengthInBytes+1)return-68;stringToUTF8(cwd,buf,size);return buf}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:abort("bad ioctl syscall "+op)}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function syscallMmap2(addr,len,prot,flags,fd,off){off<<=12;var ptr;var allocated=false;if((flags&16)!==0&&addr%16384!==0){return-28}if((flags&32)!==0){ptr=_memalign(16384,len);if(!ptr)return-48;_memset(ptr,0,len);allocated=true}else{var info=FS.getStream(fd);if(!info)return-8;var res=FS.mmap(info,addr,len,off,prot,flags);ptr=res.ptr;allocated=res.allocated}SYSCALLS.mappings[ptr]={malloc:ptr,len:len,allocated:allocated,fd:fd,prot:prot,flags:flags,offset:off};return ptr}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_mmap2(addr,len,prot,flags,fd,off){try{return syscallMmap2(addr,len,prot,flags,fd,off)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function syscallMunmap(addr,len){if((addr|0)===-1||len===0){return-28}var info=SYSCALLS.mappings[addr];if(!info)return 0;if(len===info.len){var stream=FS.getStream(info.fd);if(info.prot&2){SYSCALLS.doMsync(addr,stream,len,info.flags,info.offset)}FS.munmap(stream);SYSCALLS.mappings[addr]=null;if(info.allocated){_free(info.malloc)}}return 0}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_munmap(addr,len){try{return syscallMunmap(addr,len)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_open(path,flags,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(path);var mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ___sys_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function abortOnCannotGrowMemory(requestedSize){abort("OOM")}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _emscripten_resize_heap(requestedSize){requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function getExecutableName(){return thisProgram||"./this.program"}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator==="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _environ_get(__environ,environ_buf){try{var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _environ_sizes_get(penviron_count,penviron_buf_size){try{var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _exit(status){exit(status)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doReadv(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var stream=SYSCALLS.getStreamFromFD(fd);var HIGH_OFFSET=4294967296;var offset=offset_high*HIGH_OFFSET+(offset_low>>>0);var DOUBLE_LIMIT=9007199254740992;if(offset<=-DOUBLE_LIMIT||offset>=DOUBLE_LIMIT){return-61}FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return e.errno}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _gettimeofday(ptr){var now=Date.now();HEAP32[ptr>>2]=now/1e3|0;HEAP32[ptr+4>>2]=now%1e3*1e3|0;return 0}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _setTempRet0($i){setTempRet0($i|0)}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){HEAP32[ptr>>2]=ret}return ret}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function callMain(args){var entryFunction=Module["_main"];args=args||[];var argc=args.length+1;var argv=stackAlloc((argc+1)*4);HEAP32[argv>>2]=allocateUTF8OnStack(thisProgram);for(var i=1;i<argc;i++){HEAP32[(argv>>2)+i]=allocateUTF8OnStack(args[i-1])}HEAP32[(argv>>2)+argc]=0;try{var ret=entryFunction(argc,argv);exit(ret,true)}catch(e){if(e instanceof ExitStatus){return}else if(e=="unwind"){noExitRuntime=true;return}else{var toLog=e;if(e&&typeof e==="object"&&e.stack){toLog=[e,e.stack]}err("exception thrown: "+toLog);quit_(1,e)}}finally{calledMain=true}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}
philipsens/xml.js
src/xmllint.ts
TypeScript
FunctionDeclaration
function exit(status,implicit){if(implicit&&noExitRuntime&&status===0){return}if(noExitRuntime){}else{EXITSTATUS=status;exitRuntime();if(Module["onExit"])Module["onExit"](status);ABORT=true}quit_(status,new ExitStatus(status))}
philipsens/xml.js
src/xmllint.ts
TypeScript
InterfaceDeclaration
export interface options { xml: string; schema: string | string[]; format: string; TOTAL_MEMORY: number; }
philipsens/xml.js
src/xmllint.ts
TypeScript
ClassDeclaration
/** * Generated class for the AppsappInputDateComponent component. * * See https://angular.io/api/core/Component for more info on Angular * Components. */ export declare class AppsappInputDateComponent extends AppsappInputAbstractComponent { beforeModelChanges(model: any, property: any, value: any): boolean; /** * * @param {ConfigModel} config */ afterInit(config: any): void; }
miegli/appsapp.typo3
Resources/Private/Angular/node_modules/appsapp-module/frontend/components/input/appsapp-input-date/appsapp-input-date.d.ts
TypeScript
MethodDeclaration
beforeModelChanges(model: any, property: any, value: any): boolean;
miegli/appsapp.typo3
Resources/Private/Angular/node_modules/appsapp-module/frontend/components/input/appsapp-input-date/appsapp-input-date.d.ts
TypeScript
MethodDeclaration
/** * * @param {ConfigModel} config */ afterInit(config: any): void;
miegli/appsapp.typo3
Resources/Private/Angular/node_modules/appsapp-module/frontend/components/input/appsapp-input-date/appsapp-input-date.d.ts
TypeScript
ArrowFunction
() => { let div: HTMLDivElement; let service: BindingService; beforeEach(() => { div = document.createElement('div'); document.body.appendChild(div); }); afterEach(() => { div.remove(); jest.clearAllMocks(); }); it('should add a binding for an input and call a value change and expect a mocked object to have the reflected value', () => { const mockCallback = jest.fn(); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); elm.className = 'custom-class'; div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(elm, 'value', 'change', mockCallback); elm.value = 'Jane'; const mockEvent = new CustomEvent('change', { bubbles: true, detail: { target: { value: 'Jane' } } }); elm.dispatchEvent(mockEvent); expect(service.property).toBe('name'); expect(mockObj.name).toBe('Jane'); expect(mockCallback).toHaveBeenCalled(); }); it('should return same input value when object property is not found', () => { const mockCallback = jest.fn(); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); elm.className = 'custom-class'; div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'invalidProperty' }); service.bind(elm, 'value', 'change', mockCallback); elm.value = 'Jane'; const mockEvent = new CustomEvent('change', { bubbles: true, detail: { target: { value: 'Jane' } } }); elm.dispatchEvent(mockEvent); expect(service.property).toBe('invalidProperty'); expect(mockObj.name).toBe('John'); expect(mockCallback).toHaveBeenCalled(); }); it('should add a binding for a mocked object and expect the value to be reflected in the element input value', () => { const mockCallback = jest.fn(); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); elm.className = 'custom-class'; div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(elm, 'value', 'change', mockCallback); mockObj.name = 'Jane'; expect(service.property).toBe('name'); expect(elm.value).toBe('Jane'); }); it('should unbind an event from an element', () => { const mockElm = { addEventListener: jest.fn(), removeEventListener: jest.fn() } as unknown as HTMLElement; const mockCallback = jest.fn(); const removeEventSpy = jest.spyOn(mockElm, 'removeEventListener'); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(mockElm, 'value', 'keyup'); service.unbind(mockElm, 'click', mockCallback, false, service.boundedEventWithListeners[0].uid); expect(service.property).toBe('name'); expect(removeEventSpy).toHaveBeenCalledWith('click', mockCallback, false); }); it('should call unbindAll and expect a single unbind element being called', () => { const mockElm = { addEventListener: jest.fn(), removeEventListener: jest.fn() } as unknown as HTMLElement; const removeEventSpy = jest.spyOn(mockElm, 'removeEventListener'); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(mockElm, 'value', 'keyup'); service.unbindAll(); expect(service.property).toBe('name'); expect(removeEventSpy).toHaveBeenCalledWith('keyup', expect.toBeFunction(), undefined); }); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { div = document.createElement('div'); document.body.appendChild(div); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { div.remove(); jest.clearAllMocks(); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { const mockCallback = jest.fn(); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); elm.className = 'custom-class'; div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(elm, 'value', 'change', mockCallback); elm.value = 'Jane'; const mockEvent = new CustomEvent('change', { bubbles: true, detail: { target: { value: 'Jane' } } }); elm.dispatchEvent(mockEvent); expect(service.property).toBe('name'); expect(mockObj.name).toBe('Jane'); expect(mockCallback).toHaveBeenCalled(); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { const mockCallback = jest.fn(); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); elm.className = 'custom-class'; div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'invalidProperty' }); service.bind(elm, 'value', 'change', mockCallback); elm.value = 'Jane'; const mockEvent = new CustomEvent('change', { bubbles: true, detail: { target: { value: 'Jane' } } }); elm.dispatchEvent(mockEvent); expect(service.property).toBe('invalidProperty'); expect(mockObj.name).toBe('John'); expect(mockCallback).toHaveBeenCalled(); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { const mockCallback = jest.fn(); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); elm.className = 'custom-class'; div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(elm, 'value', 'change', mockCallback); mockObj.name = 'Jane'; expect(service.property).toBe('name'); expect(elm.value).toBe('Jane'); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { const mockElm = { addEventListener: jest.fn(), removeEventListener: jest.fn() } as unknown as HTMLElement; const mockCallback = jest.fn(); const removeEventSpy = jest.spyOn(mockElm, 'removeEventListener'); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(mockElm, 'value', 'keyup'); service.unbind(mockElm, 'click', mockCallback, false, service.boundedEventWithListeners[0].uid); expect(service.property).toBe('name'); expect(removeEventSpy).toHaveBeenCalledWith('click', mockCallback, false); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { const mockElm = { addEventListener: jest.fn(), removeEventListener: jest.fn() } as unknown as HTMLElement; const removeEventSpy = jest.spyOn(mockElm, 'removeEventListener'); const mockObj = { name: 'John', age: 20 }; const elm = document.createElement('input'); div.appendChild(elm); service = new BindingService({ variable: mockObj, property: 'name' }); service.bind(mockElm, 'value', 'keyup'); service.unbindAll(); expect(service.property).toBe('name'); expect(removeEventSpy).toHaveBeenCalledWith('keyup', expect.toBeFunction(), undefined); }
ghiscoding/slickgrid-universal
packages/binding/src/__tests__/binding.service.spec.ts
TypeScript
ArrowFunction
() => { test('turns a regular string into camelCase', () => { let testString = "a bunch of words"; let camelized = camelize(testString); let expected = "aBunchOfWords"; expect(camelized).toBe(expected); }); test('works with numbers', () => { let testString = "2 bunches of words and 3 numbers"; let camelized = camelize(testString); let expected = "2BunchesOfWordsAnd3Numbers" ; expect(camelized).toBe(expected); }); test('strips out special characters (excluding underscore)' , () => { let testString = "UPC/EAN/GTIN"; let camelized = camelize(testString); let expected = "upcEanGtin" ; expect(camelized).toBe(expected); }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let testString = "a bunch of words"; let camelized = camelize(testString); let expected = "aBunchOfWords"; expect(camelized).toBe(expected); }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let testString = "2 bunches of words and 3 numbers"; let camelized = camelize(testString); let expected = "2BunchesOfWordsAnd3Numbers" ; expect(camelized).toBe(expected); }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let testString = "UPC/EAN/GTIN"; let camelized = camelize(testString); let expected = "upcEanGtin" ; expect(camelized).toBe(expected); }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { test("returns a sheet's headers as an object with camelized names as keys and indices as values", () => { let sheetData = [['header one', 'header 2', 'a very long header three', 'item inventory', 'quantity ordered']]; let headerMap = reduceHeaders(sheetData); expect(headerMap).toHaveProperty('header2'); expect(headerMap).toHaveProperty(["itemInventory"], 3); }); }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sheetData = [['header one', 'header 2', 'a very long header three', 'item inventory', 'quantity ordered']]; let headerMap = reduceHeaders(sheetData); expect(headerMap).toHaveProperty('header2'); expect(headerMap).toHaveProperty(["itemInventory"], 3); }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { test("returns an array of objects that contain properties for headerName and index", () => { let sheetData = [['header one', 'header 2', 'a very long header three', 'item inventory', 'quantity ordered']]; let headerMap = mapHeaders(sheetData); expect(headerMap.length).toBe(sheetData[0].length); expect(headerMap[0]).toHaveProperty('headerName'); expect(headerMap[3]).toHaveProperty('headerIndex'); expect(headerMap[4]).toHaveProperty(['headerIndex'], 4) }); }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sheetData = [['header one', 'header 2', 'a very long header three', 'item inventory', 'quantity ordered']]; let headerMap = mapHeaders(sheetData); expect(headerMap.length).toBe(sheetData[0].length); expect(headerMap[0]).toHaveProperty('headerName'); expect(headerMap[3]).toHaveProperty('headerIndex'); expect(headerMap[4]).toHaveProperty(['headerIndex'], 4) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { test("returns the index of a camelized column name", () => { let sheetData = [['header one', 'header 2', 'a very long header three', 'item inventory', 'quantity ordered']]; let headerMap = mapHeaders(sheetData); let firstIndex = getIndexByHeader("headerOne", headerMap) let itemIndex = getIndexByHeader('itemInventory', headerMap) expect(firstIndex).toBe(0) expect(itemIndex).toBe(3) }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sheetData = [['header one', 'header 2', 'a very long header three', 'item inventory', 'quantity ordered']]; let headerMap = mapHeaders(sheetData); let firstIndex = getIndexByHeader("headerOne", headerMap) let itemIndex = getIndexByHeader('itemInventory', headerMap) expect(firstIndex).toBe(0) expect(itemIndex).toBe(3) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { test('Removes M US from size string', () => { let sizeWithoutDesc = '5 M US' let finalSize = cleanSize(sizeWithoutDesc) expect(finalSize).toBe('5') }) test('Removes all extra words', () => { let sizeWithDesc = '5.5 M US Little Kid' let finalSize = cleanSize(sizeWithDesc) expect(finalSize).toBe('5.5') }) test("Returns size if there are no extra words", () => { let sizeWithoutExtra = '5' let finalSize = cleanSize(sizeWithoutExtra) expect(finalSize).toBe('5') }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sizeWithoutDesc = '5 M US' let finalSize = cleanSize(sizeWithoutDesc) expect(finalSize).toBe('5') }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sizeWithDesc = '5.5 M US Little Kid' let finalSize = cleanSize(sizeWithDesc) expect(finalSize).toBe('5.5') }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sizeWithoutExtra = '5' let finalSize = cleanSize(sizeWithoutExtra) expect(finalSize).toBe('5') }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let size10 = '14598-b_10' let above10 = '14598-b_12.5' let under10 = '14598-b_7.5' test('returns sku when size 10 or over', () => { let padded = getPaddedSku(size10) expect(padded).toBe('14598-b_10') padded = getPaddedSku(above10) expect(padded).toBe('14598-b_12.5') }) test('returns padded sku (extra 0 before the size) for sizes under 10', () => { let padded = getPaddedSku(under10) expect(padded).toBe('14598-b_07.5') }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let padded = getPaddedSku(size10) expect(padded).toBe('14598-b_10') padded = getPaddedSku(above10) expect(padded).toBe('14598-b_12.5') }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let padded = getPaddedSku(under10) expect(padded).toBe('14598-b_07.5') }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let sku = '14598-b_5' test('returns an array with style and size', () => { let style = splitSku(sku)[0] let size = splitSku(sku)[1] expect(style).toBe('14598-b') expect(size).toBe('5') }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { let style = splitSku(sku)[0] let size = splitSku(sku)[1] expect(style).toBe('14598-b') expect(size).toBe('5') }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { test('fills rows with blanks to meet max', () => { const data: any[][] = [ [1, 2, "3"], [1] ] const result = padAllRows(data) const expected = [ [1, 2, "3"], [1, '', ''] ] expect(result).toEqual(expected) }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { const data: any[][] = [ [1, 2, "3"], [1] ] const result = padAllRows(data) const expected = [ [1, 2, "3"], [1, '', ''] ] expect(result).toEqual(expected) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { it("finds the first row without blanks", () => { const data = [ ['a', ''], ['a', 'b'], ['a', 'b'] ] const expected = 1 const result = detectHeaderRow(data) expect(result).toBe(expected) }) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { const data = [ ['a', ''], ['a', 'b'], ['a', 'b'] ] const expected = 1 const result = detectHeaderRow(data) expect(result).toBe(expected) }
joesasson/needless
src/__tests__/index.test.ts
TypeScript
ArrowFunction
() => { it('should create an instance', () => { const directive = new ClipboardDirective(); expect(directive).toBeTruthy(); }); }
ACRCode/acr_assist_simulator_control
src/app/modules/acr-assist-simulator/shared/directives/clipboard.directive.spec.ts
TypeScript
ArrowFunction
() => { const directive = new ClipboardDirective(); expect(directive).toBeTruthy(); }
ACRCode/acr_assist_simulator_control
src/app/modules/acr-assist-simulator/shared/directives/clipboard.directive.spec.ts
TypeScript
ClassDeclaration
export default class A extends HTMLElement { count: number = 10; text: Text; constructor(opts: any) { super(); this.text = new Text(`Count: ${this.count}`); this.append(this.text); } static ret(arr: string) {} attributeChangedCallback(prop: string, value: any) { this.text.data = `Count: ${this.count}`; } }
SRNV/Ogone
examples/tests/reusable/component-module.ts
TypeScript
MethodDeclaration
static ret(arr: string) {}
SRNV/Ogone
examples/tests/reusable/component-module.ts
TypeScript
MethodDeclaration
attributeChangedCallback(prop: string, value: any) { this.text.data = `Count: ${this.count}`; }
SRNV/Ogone
examples/tests/reusable/component-module.ts
TypeScript
ArrowFunction
() => SelectComponent
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
_ => { this._setOptionsArray(); this._setOptionsProperties(); this._setSelectedOption(); this._listenOnOptionKeydown(); setTimeout(() => { if (this.selected === undefined && this.unselectMissingOption) { this._updateValue(undefined); this._setSelectViewValue(); this._changeDetectorRef.markForCheck(); } }); }
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
() => { if (this.selected === undefined && this.unselectMissingOption) { this._updateValue(undefined); this._setSelectViewValue(); this._changeDetectorRef.markForCheck(); } }
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
option => { this._subscriptions.add( option.selectionEvent.pipe( takeUntil(this._refresh$), filter(event => !!event) ).subscribe(event => this.keydownHandler(event)) ) }
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
event => !!event
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
event => this.keydownHandler(event)
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
_ => this.onTouched()
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript
ArrowFunction
option => option.selected
AntonOlkhovskyi/fundamental-ngx
libs/core/src/lib/select/select.component.ts
TypeScript