Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/code-highlighting.spec.js
Show All 18 Lines | describe('Code highlighting tests', function() { | ||||
before(function() { | before(function() { | ||||
origin = this.origin[0]; | origin = this.origin[0]; | ||||
url = this.Urls.browse_origin_content(origin.url, origin.content[0].path); | url = this.Urls.browse_origin_content(origin.url, origin.content[0].path); | ||||
}); | }); | ||||
it('should highlight source code and add line numbers', function() { | it('should highlight source code and add line numbers', function() { | ||||
cy.visit(url); | cy.visit(url); | ||||
cy.get('.hljs-ln-numbers').then(lnNumbers => { | cy.get('.hljs-ln-numbers').then(lnNumbers => { | ||||
cy.get('.hljs-ln-code').then(lnCode => { | cy.get('.hljs-ln-code') | ||||
assert.equal(lnNumbers.length, lnCode.length); | .should('have.length', lnNumbers.length); | ||||
}); | |||||
}); | }); | ||||
}); | }); | ||||
it('should emphasize source code lines based on url fragment', function() { | it('should emphasize source code lines based on url fragment', function() { | ||||
cy.visit(`${url}/#L${lineStart}-L${lineEnd}`); | cy.visit(`${url}/#L${lineStart}-L${lineEnd}`); | ||||
cy.get('.hljs-ln-line').then(lines => { | cy.get('.hljs-ln-line').then(lines => { | ||||
for (let line of lines) { | for (let line of lines) { | ||||
const lineElt = $(line); | const lineElt = $(line); | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |