Skip to content

Commit

Permalink
FLUID-6103: better detection of Chrome; add check for Edge.
Browse files Browse the repository at this point in the history
  • Loading branch information
waharnum committed Jan 16, 2017
1 parent 6d75a45 commit b848819
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test-core/utils/js/ConditionalTestUtils.js
Expand Up @@ -112,8 +112,10 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

// Functions for web browser name reporting for makeChecks

// Edge reports Chrome in its userAgent string, so we have to additionally check for
// the Edge string
fluid.test.conditionalTestUtils.isChromeBrowser = function () {
return fluid.test.conditionalTestUtils.contextValueContains("Chrome", "{fluid.browser.userAgent}");
return fluid.test.conditionalTestUtils.contextValueContains("Chrome", "{fluid.browser.userAgent}") && !fluid.test.conditionalTestUtils.contextValueContains("Edge", "{fluid.browser.userAgent}");;
};

// We have to check that the userAgent string contains Safari, but does not
Expand All @@ -126,11 +128,16 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
return fluid.test.conditionalTestUtils.contextValueContains("Firefox", "{fluid.browser.userAgent}");
};

fluid.test.conditionalTestUtils.isEdgeBrowser = function () {
return fluid.test.conditionalTestUtils.contextValueContains("Edge", "{fluid.browser.userAgent}");
};

// Makes checks for browser name
fluid.contextAware.makeChecks({
"fluid.browser.isChrome": "fluid.test.conditionalTestUtils.isChromeBrowser",
"fluid.browser.isSafari": "fluid.test.conditionalTestUtils.isSafariBrowser",
"fluid.browser.isFirefox": "fluid.test.conditionalTestUtils.isFirefoxBrowser"
"fluid.browser.isFirefox": "fluid.test.conditionalTestUtils.isFirefoxBrowser",
"fluid.browser.isEdge": "fluid.test.conditionalTestUtils.isEdgeBrowser"
});

})();

0 comments on commit b848819

Please sign in to comment.