X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fis-function%2Ftest.js;fp=node_modules%2Fis-function%2Ftest.js;h=b3ac5e468658b004c2f86efc947f2cfb769c19c5;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/is-function/test.js b/node_modules/is-function/test.js new file mode 100644 index 000000000..b3ac5e468 --- /dev/null +++ b/node_modules/is-function/test.js @@ -0,0 +1,37 @@ +var test = require('tape') +var isFunction = require('./index.js') + +test('isFunction', function (t) { + t.ok(!isFunction(), 'undefined is not a function') + t.ok(!isFunction(null), 'null is not a function') + t.ok(!isFunction(''), 'string is not a function') + t.ok(!isFunction(/a/), 'regex is not a function') + t.ok(!isFunction(true), 'true is not a function') + t.ok(!isFunction(false), 'false is not a function') + t.ok(!isFunction(NaN), 'NaN is not a function') + t.ok(!isFunction(42), '42 is not a function') + t.ok(isFunction(function () {}), 'function is a function') + t.ok(isFunction(setTimeout), 'setTimeout is a function') + t.end() +}) + +if (typeof window !== 'undefined') { + test('browser quirks', function (t) { + t.plan(2) + + t.ok(isFunction(window.alert), 'alert is a function') + + window.testRegExpFromIframe = function (regexp) { + t.ok(!isFunction(regexp)) + } + + var iframe = document.createElement('iframe') + document.body.appendChild(iframe) + + iframe.contentWindow.document.write([ + "" + ].join("\n")); + }) +}