scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 124  →  ?path2? @ 125
/bower_components/fingerprintjs2/specs/specs.js
@@ -31,7 +31,7 @@
});
 
describe("sortPluginsFor", function () {
it("has default value", function (){
it("has default value", function () {
var fp2 = new Fingerprint2();
expect(fp2.options.sortPluginsFor).toEqual([/palemoon/i]);
});
@@ -53,7 +53,7 @@
describe("default options", function () {
it("calculates fingerprint", function (done) {
var fp2 = new Fingerprint2();
fp2.get(function(result){
fp2.get(function (result) {
expect(result).toMatch(/^[0-9a-f]{32}$/i);
done();
});
@@ -62,7 +62,7 @@
it("does not try calling flash font detection", function (done) {
var fp2 = new Fingerprint2();
spyOn(fp2, "flashFontsKey");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.flashFontsKey).not.toHaveBeenCalled();
done();
});
@@ -73,7 +73,7 @@
it("does not use userAgent when excluded", function (done) {
var fp2 = new Fingerprint2({excludeUserAgent: true});
spyOn(fp2, "getUserAgent");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.getUserAgent).not.toHaveBeenCalled();
done();
});
@@ -82,7 +82,7 @@
it("does not use pixelRatio when excluded", function (done) {
var fp2 = new Fingerprint2({excludePixelRatio: true});
spyOn(fp2, "getPixelRatio");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.getPixelRatio).not.toHaveBeenCalled();
done();
});
@@ -91,7 +91,7 @@
it("does not use screen resolution when excluded", function (done) {
var fp2 = new Fingerprint2({excludeScreenResolution: true});
spyOn(fp2, "getScreenResolution");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.getScreenResolution).not.toHaveBeenCalled();
done();
});
@@ -100,7 +100,7 @@
it("does not use available screen resolution when excluded", function (done) {
var fp2 = new Fingerprint2({excludeAvailableScreenResolution: true});
spyOn(fp2, "getAvailableScreenResolution");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.getAvailableScreenResolution).not.toHaveBeenCalled();
done();
});
@@ -109,7 +109,7 @@
it("does not use plugins info when excluded", function (done) {
var fp2 = new Fingerprint2({excludePlugins: true});
spyOn(fp2, "getRegularPlugins");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.getRegularPlugins).not.toHaveBeenCalled();
done();
});
@@ -118,7 +118,7 @@
it("does not use IE plugins info when excluded", function (done) {
var fp2 = new Fingerprint2({excludeIEPlugins: true});
spyOn(fp2, "getIEPlugins");
fp2.get(function(result) {
fp2.get(function (result) {
expect(fp2.getIEPlugins).not.toHaveBeenCalled();
done();
});
@@ -129,7 +129,7 @@
describe("returns components", function () {
it("does it return components as a second argument to callback", function (done) {
var fp2 = new Fingerprint2();
fp2.get(function(result, components) {
fp2.get(function (result, components) {
expect(components).not.toBeNull();
done();
});
@@ -137,7 +137,7 @@
 
it("checks if returned components is array", function (done) {
var fp2 = new Fingerprint2();
fp2.get(function(result, components) {
fp2.get(function (result, components) {
expect(components).toBeArrayOfObjects();
done();
});
@@ -145,10 +145,10 @@
 
it("checks if js_fonts component is array", function (done) {
var fp2 = new Fingerprint2();
fp2.get(function(result, components) {
for(var x = 0; x < components.length; x++) {
if(components[x].key == "js_fonts") {
expect(components[x].value).toBeArray();
fp2.get(function (result, components) {
for (var x = 0; x < components.length; x++) {
if (components[x].key == "js_fonts") {
expect(components[x].value).toBeArray();
}
}
done();
@@ -157,7 +157,7 @@
 
it("returns user_agent as the first element", function (done) {
var fp2 = new Fingerprint2();
fp2.get(function(result, components) {
fp2.get(function (result, components) {
expect(components[0].key).toEqual("user_agent");
done();
});
@@ -197,19 +197,23 @@
describe("userDefinedFonts option", function () {
it("concatinates existing fonts with user-defined", function (done) {
var fontList = [
"Andale Mono", "Arial", "Arial Black", "Arial Hebrew", "Arial MT", "Arial Narrow", "Arial Rounded MT Bold", "Arial Unicode MS",
"Bitstream Vera Sans Mono", "Book Antiqua", "Bookman Old Style",
"Calibri", "Cambria", "Cambria Math", "Century", "Century Gothic", "Century Schoolbook", "Comic Sans", "Comic Sans MS", "Consolas", "Courier", "Courier New",
"Garamond", "Geneva", "Georgia",
"Helvetica", "Helvetica Neue",
"Impact",
"Lucida Bright", "Lucida Calligraphy", "Lucida Console", "Lucida Fax", "LUCIDA GRANDE", "Lucida Handwriting", "Lucida Sans", "Lucida Sans Typewriter", "Lucida Sans Unicode",
"Microsoft Sans Serif", "Monaco", "Monotype Corsiva", "MS Gothic", "MS Outlook", "MS PGothic", "MS Reference Sans Serif", "MS Sans Serif", "MS Serif", "MYRIAD", "MYRIAD PRO",
"Palatino", "Palatino Linotype",
"Segoe Print", "Segoe Script", "Segoe UI", "Segoe UI Light", "Segoe UI Semibold", "Segoe UI Symbol",
"Tahoma", "Times", "Times New Roman", "Times New Roman PS", "Trebuchet MS",
"Verdana", "Wingdings", "Wingdings 2", "Wingdings 3"
];
"Andale Mono", "Arial", "Arial Black", "Arial Hebrew", "Arial MT", "Arial Narrow", "Arial Rounded MT Bold",
"Arial Unicode MS",
"Bitstream Vera Sans Mono", "Book Antiqua", "Bookman Old Style",
"Calibri", "Cambria", "Cambria Math", "Century", "Century Gothic", "Century Schoolbook", "Comic Sans",
"Comic Sans MS", "Consolas", "Courier", "Courier New",
"Garamond", "Geneva", "Georgia",
"Helvetica", "Helvetica Neue",
"Impact",
"Lucida Bright", "Lucida Calligraphy", "Lucida Console", "Lucida Fax", "LUCIDA GRANDE", "Lucida Handwriting",
"Lucida Sans", "Lucida Sans Typewriter", "Lucida Sans Unicode",
"Microsoft Sans Serif", "Monaco", "Monotype Corsiva", "MS Gothic", "MS Outlook", "MS PGothic",
"MS Reference Sans Serif", "MS Sans Serif", "MS Serif", "MYRIAD", "MYRIAD PRO",
"Palatino", "Palatino Linotype",
"Segoe Print", "Segoe Script", "Segoe UI", "Segoe UI Light", "Segoe UI Semibold", "Segoe UI Symbol",
"Tahoma", "Times", "Times New Roman", "Times New Roman PS", "Trebuchet MS",
"Verdana", "Wingdings", "Wingdings 2", "Wingdings 3"
];
 
expect(fontList.length).toEqual(65);
var userDefinedFonts = [];
@@ -216,7 +220,6 @@
fontList.concat(userDefinedFonts);
expect(fontList.length).toEqual(65);
 
 
userDefinedFonts = ["Adria Grotesk", "Butler", "Nimbus Mono"];
expect(userDefinedFonts.length).toEqual(3);
fontList = fontList.concat(userDefinedFonts);
@@ -224,5 +227,21 @@
done();
});
});
describe("customFunction option", function () {
 
it("concatinates the current keys with the customFunction output", function (done) {
function customFunction () {
return "RANDOM_STRING";
}
var spy = jasmine.createSpy('customFunction', customFunction).and.callThrough();
var fp = new Fingerprint2({
"customFunction": spy
});
fp.get(function (result, keys) {
expect(spy).toHaveBeenCalled();
done()
});
});
});
});
});