Skip to content

Commit

Permalink
refactor(data-structure): matched updated shape of speaker
Browse files Browse the repository at this point in the history
the shape was updated to enable separating files. hopefully there will be a follow up to remove some
of the details that make it obvious that the data was queried using graphql from markdown
frontmatter, but this gets things working for now

BREAKING CHANGE: the shape of the speaker details under talk has changed

for dsmjs/site#14
  • Loading branch information
travi committed Jun 18, 2018
1 parent 051c8bc commit b4d3342
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/molecules/talk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function Talk({talk, content}) {
return (
<Fragment>
<h1 style={{color: '#AD5472'}}>{talk.title}</h1>
<h3>{talk.speaker}</h3>
<h3>{talk.speaker.frontmatter.name}</h3>
<div dangerouslySetInnerHTML={{__html: content}} />
</Fragment>
);
Expand All @@ -14,7 +14,11 @@ export default function Talk({talk, content}) {
Talk.propTypes = {
talk: shape({
title: string,
speaker: string
speaker: shape({
frontmatter: shape({
name: string
})
})
}),
content: string
};
5 changes: 3 additions & 2 deletions test/unit/molecules/talk/presentational-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import Talk from '../../../../src/molecules/talk';

suite('talk', () => {
test('that the title and speaker details are displayed', () => {
const talk = {title: any.sentence(), speaker: any.string()};
const speakerName = any.string();
const talk = {title: any.sentence(), speaker: {frontmatter: {name: speakerName}}};
const htmlContent = any.string();

const wrapper = shallow(<Talk talk={talk} content={htmlContent} />);

assert.equal(wrapper.find('h1').text(), talk.title);
assert.equal(wrapper.find('h3').text(), talk.speaker);
assert.equal(wrapper.find('h3').text(), speakerName);
assert.deepEqual(wrapper.find('div').prop('dangerouslySetInnerHTML'), {__html: htmlContent});
});
});

0 comments on commit b4d3342

Please sign in to comment.