Skip to content

Commit

Permalink
added optional chaining to hasCode property for consistency
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
elzody committed Feb 21, 2024
1 parent afcf0a5 commit 2e5975e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions cypress/e2e/nodes/CodeBlock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ describe('Front matter support', function() {

// Copy code to clipboard
cy.getContent().find('code').eq(1).invoke('text')
.then(code =>
cy.window().then(win => {
win.navigator.clipboard.readText()
.then(copiedCode => {
expect(copiedCode).to.equal(code)
})
})
)
.then(code =>
cy.window().then(win => {
win.navigator.clipboard.readText()
.then(copiedCode => {
expect(copiedCode).to.equal(code)
})
}),
)

// Remove language
cy.getContent().find('.code-block').eq(1).find('.view-switch div div button').click()
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/CodeBlockView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default {
},
computed: {
hasCode() {
return this.node.textContent
return this.node?.textContent
},
type() {
return this.node?.attrs?.language || ''
Expand Down

0 comments on commit 2e5975e

Please sign in to comment.