summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/BrowserInfo.java8
-rw-r--r--client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java29
2 files changed, 37 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/BrowserInfo.java b/client/src/main/java/com/vaadin/client/BrowserInfo.java
index 8dcefddcf5..d1592c95f4 100644
--- a/client/src/main/java/com/vaadin/client/BrowserInfo.java
+++ b/client/src/main/java/com/vaadin/client/BrowserInfo.java
@@ -165,6 +165,14 @@ public class BrowserInfo {
minorVersionClass = majorVersionClass
+ browserDetails.getBrowserMinorVersion();
browserEngineClass = ENGINE_WEBKIT;
+ } else if (browserDetails.isPhantomJS()) {
+ // Safari needed for theme
+ browserIdentifier = BROWSER_SAFARI;
+ majorVersionClass = browserIdentifier
+ + getBrowserMajorVersion();
+ minorVersionClass = majorVersionClass
+ + browserDetails.getBrowserMinorVersion();
+ browserEngineClass = ENGINE_WEBKIT;
} else if (browserDetails.isIE()) {
browserIdentifier = BROWSER_IE;
majorVersionClass = browserIdentifier
diff --git a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java
index 5522b8e2bc..41e675cb3a 100644
--- a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java
+++ b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java
@@ -61,6 +61,8 @@ public class VBrowserDetailsUserAgentParserTest {
private static final String EDGE_WINDOWS_10 = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240";
+ private static final String PHANTOMJS_211_MAC = "Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1";
+
@Test
public void testSafari3() {
VBrowserDetails bd = new VBrowserDetails(SAFARI3_WINDOWS);
@@ -471,6 +473,16 @@ public class VBrowserDetailsUserAgentParserTest {
assertWindows(bd, false);
}
+ @Test
+ public void testPhantomJs211() {
+ VBrowserDetails bd = new VBrowserDetails(PHANTOMJS_211_MAC);
+ assertPhantomJS(bd);
+ assertWebKit(bd);
+ assertBrowserMajorVersion(bd, 2);
+ assertBrowserMinorVersion(bd, 1);
+ assertMacOSX(bd);
+ }
+
/*
* Helper methods below
*/
@@ -525,6 +537,17 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isTrident());
}
+ private void assertPhantomJS(VBrowserDetails browserDetails) {
+ // Browser
+ assertFalse(browserDetails.isFirefox());
+ assertFalse(browserDetails.isChrome());
+ assertFalse(browserDetails.isIE());
+ assertFalse(browserDetails.isOpera());
+ assertFalse(browserDetails.isSafari());
+ assertFalse(browserDetails.isEdge());
+ assertTrue(browserDetails.isPhantomJS());
+ }
+
private void assertFirefox(VBrowserDetails browserDetails) {
// Browser
assertTrue(browserDetails.isFirefox());
@@ -533,6 +556,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isOpera());
assertFalse(browserDetails.isSafari());
assertFalse(browserDetails.isEdge());
+ assertFalse(browserDetails.isPhantomJS());
}
private void assertChrome(VBrowserDetails browserDetails) {
@@ -543,6 +567,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isOpera());
assertFalse(browserDetails.isSafari());
assertFalse(browserDetails.isEdge());
+ assertFalse(browserDetails.isPhantomJS());
}
private void assertIE(VBrowserDetails browserDetails) {
@@ -553,6 +578,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isOpera());
assertFalse(browserDetails.isSafari());
assertFalse(browserDetails.isEdge());
+ assertFalse(browserDetails.isPhantomJS());
}
private void assertOpera(VBrowserDetails browserDetails) {
@@ -563,6 +589,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertTrue(browserDetails.isOpera());
assertFalse(browserDetails.isSafari());
assertFalse(browserDetails.isEdge());
+ assertFalse(browserDetails.isPhantomJS());
}
private void assertSafari(VBrowserDetails browserDetails) {
@@ -573,6 +600,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isOpera());
assertTrue(browserDetails.isSafari());
assertFalse(browserDetails.isEdge());
+ assertFalse(browserDetails.isPhantomJS());
}
private void assertEdge(VBrowserDetails browserDetails) {
@@ -583,6 +611,7 @@ public class VBrowserDetailsUserAgentParserTest {
assertFalse(browserDetails.isOpera());
assertFalse(browserDetails.isSafari());
assertTrue(browserDetails.isEdge());
+ assertFalse(browserDetails.isPhantomJS());
}
private void assertMacOSX(VBrowserDetails browserDetails) {