aboutsummaryrefslogtreecommitdiffstats
path: root/tests/runner/browserstack/buildBrowserFromString.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywil@users.noreply.github.com>2024-04-09 13:31:27 -0400
committerGitHub <noreply@github.com>2024-04-09 13:31:27 -0400
commit4af5caed7a16cc0aca6b8f2b65ab0d697df139eb (patch)
tree6986a82205fa38ac5139cacb1b3fb22200c9a089 /tests/runner/browserstack/buildBrowserFromString.js
parent213fdbaa285158a21546b3edcb912275fed4a334 (diff)
downloadjquery-ui-4af5caed7a16cc0aca6b8f2b65ab0d697df139eb.tar.gz
jquery-ui-4af5caed7a16cc0aca6b8f2b65ab0d697df139eb.zip
Tests: align test runner with other repos
Close gh-2234
Diffstat (limited to 'tests/runner/browserstack/buildBrowserFromString.js')
-rw-r--r--tests/runner/browserstack/buildBrowserFromString.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/runner/browserstack/buildBrowserFromString.js b/tests/runner/browserstack/buildBrowserFromString.js
new file mode 100644
index 000000000..e0d99a039
--- /dev/null
+++ b/tests/runner/browserstack/buildBrowserFromString.js
@@ -0,0 +1,20 @@
+export function buildBrowserFromString( str ) {
+ const [ browser, versionOrDevice, os, osVersion ] = str.split( "_" );
+
+ // If the version starts with a colon, it's a device
+ if ( versionOrDevice && versionOrDevice.startsWith( ":" ) ) {
+ return {
+ browser,
+ device: versionOrDevice.slice( 1 ),
+ os,
+ os_version: osVersion
+ };
+ }
+
+ return {
+ browser,
+ browser_version: versionOrDevice,
+ os,
+ os_version: osVersion
+ };
+}