Skip to content

Commit

Permalink
fix: add section as a prop of ad composer
Browse files Browse the repository at this point in the history
  • Loading branch information
JGAntunes committed Jul 4, 2017
1 parent 71af2ae commit 431d9a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/gpt/__tests__/ad-composer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("AdComposer test", () => {
it("renders a snapshot with one Ad", () => {
const tree = renderer
.create(
<AdComposer>
<AdComposer section="article">
<Ad code="ad-header" />
</AdComposer>
)
Expand All @@ -27,7 +27,7 @@ describe("AdComposer test", () => {
it("renders a snapshot with more than one Ad", () => {
const tree = renderer
.create(
<AdComposer>
<AdComposer section="article">
<Ad code="ad-header" />
<Ad code="intervention" />
</AdComposer>
Expand Down
7 changes: 6 additions & 1 deletion packages/gpt/ad-composer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { Broadcast } from "react-broadcast";

import AdManager from "./ad-manager";
Expand All @@ -15,7 +16,7 @@ class AdComposer extends Component {
this.adManager = new AdManager({
networkId: "25436805",
adUnit: "d.thetimes.co.uk",
section: "article",
section: props.section,
gptManager,
pbjsManager,
getSlotConfig
Expand All @@ -39,4 +40,8 @@ class AdComposer extends Component {
}
}

AdComposer.propTypes = {
section: PropTypes.string.isRequired
};

export default AdComposer;
2 changes: 1 addition & 1 deletion packages/gpt/gpt.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ storiesOf("GPT", module).add("render two ads in article page", () => {
>
Render ads
</a>
<AdComposer>
<AdComposer section="article">
<Ad code="ad-header" />
<Ad code="intervention" />
</AdComposer>
Expand Down

0 comments on commit 431d9a1

Please sign in to comment.