Browse Source

Merge v1.1.0

Gaël Métais 10 năm trước cách đây
mục cha
commit
7e7331fb6f

+ 1 - 0
Gruntfile.js

@@ -100,6 +100,7 @@ module.exports = function(grunt) {
                 files: [
                     {src: ['./front/src/fonts/icons.woff'], dest: './front/build/fonts/icons.woff'},
                     {src: ['./front/src/img/favicon.png'], dest: './front/build/img/favicon.png'},
+                    {src: ['./front/src/img/logo-large.png'], dest: './front/build/img/logo-large.png'},
                 ]
             }
         },

BIN
front/src/img/logo-large.png


+ 1 - 0
front/src/main.html

@@ -4,6 +4,7 @@
     <title>Yellow Lab Tools</title>
     <base href="/">
     <link rel="icon" type="image/png" href="/img/favicon.png">
+    <meta property="og:image" content="/img/logo-large.png" />
 
     <!-- build:css /css/styles.css-->
     <link rel="stylesheet" type="text/css" href="/css/main.css">

+ 1 - 23
lib/tools/phantomas/custom_modules/modules/jQYLT/jQYLT.js

@@ -62,6 +62,7 @@ exports.module = function(phantomas) {
         'delegate',
         'undelegate',
         'one',
+        'bind',
         'unbind',
 
         // more events
@@ -182,29 +183,6 @@ exports.module = function(phantomas) {
                         phantomas.leaveContext(moreData);
                     }) || phantomas.log('jQuery: can not measure jQuerySizzleCalls (jQuery used on the page is too old)!');
 
-                    
-                    // $().bind - jQuery.bind
-                    // works for jQuery v?.?
-                    phantomas.spy(jQueryFn, 'bind', function(eventTypes, func) {
-                        
-                        phantomas.enterContext({
-                            type: 'jQuery - bind',
-                            callDetails: {
-                                context: {
-                                    length: this.length,
-                                    firstElementPath: phantomas.getDOMPath(this[0]),
-                                    selector: this.selector
-                                },
-                                arguments: [eventTypes, func]
-                            },
-                            backtrace: phantomas.getBacktrace()
-                        });
-
-                    }, function(result) {
-                        phantomas.leaveContext();                        
-                    }) || phantomas.log('jQuery: can not measure jQueryBindCalls (jQuery used on the page is too old)!');
-
-
 
                     // Add spys on many jQuery functions
                     jQueryFunctions.forEach(function(functionName) {

+ 53 - 0
test/server/phantomasWrapperTest.js

@@ -0,0 +1,53 @@
+var should = require('chai').should();
+var phantomasWrapper = require('../../app/lib/phantomasWrapper.js');
+
+describe('phantomasWrapper', function() {
+    
+    it('should have a method execute', function() {
+        phantomasWrapper.should.have.property('execute').that.is.a('function');
+    });
+    
+    it('should execute', function(done) {
+        var url = 'http://example.com/';
+
+        this.timeout(20000);
+        phantomasWrapper.execute({
+            url: url,
+            testId: '123abc',
+            options:{
+
+            }
+        }, function(err, json, results) {
+            should.not.exist(err);
+            
+            json.should.be.an('object');
+            json.should.have.a.property('generator');
+            json.generator.should.contain('phantomas');
+            json.should.have.a.property('url').that.equals(url);
+            json.should.have.a.property('metrics').that.is.an('object').not.empty;
+            json.should.have.a.property('offenders').that.is.an('object').not.empty;
+            json.offenders.should.have.a.property('javascriptExecutionTree').that.is.a('array').not.empty;
+
+            done();
+        });
+    });
+
+    it('should fail with error 254', function(done) {
+        var url = 'http://www.not.existing';
+
+        this.timeout(15000);
+        phantomasWrapper.execute({
+            url: url,
+            testId: '123abc',
+            options:{
+
+            }
+        }, function(err, json, results) {
+            should.exist(err);
+            err.should.equal(254);
+            should.not.exist(json);
+
+            done();
+        });
+    });
+});