alpine-turbo-drive-adapter
Version:
Bridge library to enable full support for Alpine components in pages using Turbolinks/Turbo Drive
45 lines (32 loc) • 1.12 kB
JavaScript
/* global describe, it, cy */
describe('turbo-frame', () => {
it('work correctly with Alpine', () => {
cy.visit('/tests/res/turbo/frame/index.html')
// Load frame content
cy.get('a').click()
// Test we are still on the same page
cy.url().should('equal', 'http://localhost:8080/tests/res/turbo/frame/index.html')
// Test frame loaded correctly
cy.get('span').contains(/^bar$/)
})
it('work correctly with Alpine when lazyloaded', () => {
cy.visit('/tests/res/turbo/frame-lazy/index.html')
cy.get('p').contains(/^Foo$/)
cy.get('span').contains(/^bar$/)
// Navigate to the second page
cy.get('a').click()
// test
cy.get('span').contains(/^bar$/)
cy.get('p').contains(/^Foo$/)
})
it('work correctly with Alpine when lazyloaded and using navigation top', () => {
cy.visit('/tests/res/turbo/frame-lazy-top/index.html')
cy.get('p').contains(/^Foo$/)
cy.get('span').contains(/^bar$/)
// Navigate to the second page
cy.get('a').click()
// test
cy.get('span').contains(/^bar$/)
cy.get('p').contains(/^Foo$/)
})
})