diff --git a/src/core/session.js b/src/core/session.js
index 181b6b2a2..e7e57a90f 100644
--- a/src/core/session.js
+++ b/src/core/session.js
@@ -144,6 +144,22 @@ export class Session {
return config.drive.progressBarDelay
}
+ set drive(value) {
+ config.drive.enabled = value
+ }
+
+ get drive() {
+ return config.drive.enabled
+ }
+
+ set formMode(value) {
+ config.forms.mode = value
+ }
+
+ get formMode() {
+ return config.forms.mode
+ }
+
get location() {
return this.history.location
}
diff --git a/src/tests/fixtures/drive_disabled.html b/src/tests/fixtures/drive_disabled.html
index da787f0bb..477ca3c65 100644
--- a/src/tests/fixtures/drive_disabled.html
+++ b/src/tests/fixtures/drive_disabled.html
@@ -15,7 +15,7 @@
})
diff --git a/src/tests/functional/frame_tests.js b/src/tests/functional/frame_tests.js
index 3b0770c39..30381a52c 100644
--- a/src/tests/functional/frame_tests.js
+++ b/src/tests/functional/frame_tests.js
@@ -163,7 +163,7 @@ test("successfully following a link to a page without a matching frame shows an
await page.click("#missing-frame-link")
- assert.match(await page.innerText("#missing"), /Content missing/)
+ await expect(page.locator("#missing")).toHaveText("Content missing")
assert.exists(error)
assert.include(error.message, `The response (200) did not contain the expected `)
@@ -195,7 +195,7 @@ test("failing to follow a link to a page without a matching frame shows an error
await page.click("#missing-page-link")
- assert.match(await page.innerText("#missing"), /Content missing/)
+ await expect(page.locator("#missing")).toHaveText("Content missing")
assert.exists(error)
assert.include(error.message, `The response (404) did not contain the expected `)
diff --git a/src/tests/unit/export_tests.js b/src/tests/unit/export_tests.js
index d255a3fc0..485963043 100644
--- a/src/tests/unit/export_tests.js
+++ b/src/tests/unit/export_tests.js
@@ -19,9 +19,28 @@ test("Turbo interface", () => {
assert.equal(typeof Turbo.cache.clear, "function")
assert.equal(typeof Turbo.navigator, "object")
assert.equal(typeof Turbo.session, "object")
+ assert.equal(typeof Turbo.session.drive, "boolean")
+ assert.equal(typeof Turbo.session.formMode, "string")
assert.equal(typeof Turbo.fetch, "function")
})
+test("Session interface", () => {
+ const { session, config } = Turbo
+
+ assert.equal(true, session.drive)
+ assert.equal(true, config.drive.enabled)
+ assert.equal("on", session.formMode)
+ assert.equal("on", config.forms.mode)
+
+ session.drive = false
+ session.formMode = "off"
+
+ assert.equal(false, session.drive)
+ assert.equal(false, config.drive.enabled)
+ assert.equal("off", session.formMode)
+ assert.equal("off", config.forms.mode)
+})
+
test("StreamActions interface", () => {
assert.equal(typeof StreamActions, "object")
})