-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(talk-title): formatted markdown titles in the archive list
for #806
- Loading branch information
Showing
4 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
import React from 'react'; | ||
import {shallow} from 'enzyme'; | ||
import {assert} from 'chai'; | ||
import sinon from 'sinon'; | ||
import any from '@travi/any'; | ||
import * as formatters from '../../formatters'; | ||
import ArchiveListItem from '.'; | ||
|
||
suite('archive list-item', () => { | ||
let sandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
|
||
sandbox.stub(formatters, 'markdown'); | ||
}); | ||
|
||
teardown(() => sandbox.restore()); | ||
|
||
test('that the meeting details are linked from the list item', () => { | ||
const slug = any.url(); | ||
const title = any.sentence(); | ||
const formattedTitle = any.sentence(); | ||
const meetingDetails = {date: any.date(), talks: [{talk: {frontmatter: {title}}}]}; | ||
const meeting = {node: {frontmatter: meetingDetails, fields: {slug}}}; | ||
formatters.markdown.withArgs(title).returns(formattedTitle); | ||
|
||
const wrapper = shallow(<ArchiveListItem meeting={meeting} />); | ||
const heading = wrapper.find('h4'); | ||
const description = wrapper.find('li'); | ||
|
||
assert.equal(heading.find('InternalLink').children().text(), meetingDetails.date); | ||
assert.equal(heading.find('InternalLink').prop('to'), slug); | ||
assert.equal(description.text(), title); | ||
assert.equal(description.text(), formattedTitle); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters