Sfoglia il codice sorgente

force PhantomJS window dimensions

Adam Shaw 9 anni fa
parent
commit
b7cdc9b72b
2 ha cambiato i file con 16 aggiunte e 3 eliminazioni
  1. 2 2
      Gruntfile.js
  2. 14 1
      build/karma.conf.js

+ 2 - 2
Gruntfile.js

@@ -165,8 +165,8 @@ module.exports = function(grunt) {
 			configFile: 'build/karma.conf.js'
 		},
 		url: {}, // visit a URL in a browser
-		headless: { browsers: [ 'PhantomJS' ] },
-		single: { browsers: [ 'PhantomJS' ], singleRun: true, autoWatch: false }
+		headless: { browsers: [ 'PhantomJS_custom' ] },
+		single: { browsers: [ 'PhantomJS_custom' ], singleRun: true, autoWatch: false }
 	};
 
 

+ 14 - 1
build/karma.conf.js

@@ -76,6 +76,19 @@ module.exports = function(config) {
 		autoWatch: true,
 
 		// If browser does not capture in given timeout [ms], kill it
-		captureTimeout: 60000
+		captureTimeout: 60000,
+
+		// force a window size for PhantomJS, because it's usually unreasonably small, resulting in offset problems
+		customLaunchers: {
+			PhantomJS_custom: {
+				base: 'PhantomJS',
+				options: {
+					viewportSize: {
+						width: 1024,
+						height: 768
+					}
+				}
+			}
+		}
 	});
 };