Skip to content

Commit

Permalink
Merge tag 'v1.7.1' into merge-1.7.1-into-v2.x
Browse files Browse the repository at this point in the history
1.7.1

* tag 'v1.7.1': (22 commits)
  1.7.1
  Bundle last changes
  Handle VAST2/3/4 creative adId format
  1.7.0
  Bundle last changes
  Parser - handle click/clickthrough event for nonlinear/companion ads
  Parse nonlinear click tracking urls
  Parse all nonlinear attributes
  Parse VAST Duration tag with number instead of HH:MM:SS
  VAST parser returns creative id, adId, sequence and apiFramework attributes
  Wrapper limit handling (#157)
  changes to parse altText fixes #154 (#155)
  Added NonLinear AdParameter Parsing with adequate test in sample.xml #152 (#153)
  Add Common-tasks.md (#148)
  1.6.0
  Bundle last changes
  leftpad cachebusting macro
  rework resolveURLTemplates()
  Add unit test for #text extension
  Remove empty #text/ #comments from parsed extensions
  ...
  • Loading branch information
briganti committed Apr 18, 2017
2 parents 6f3fbbf + 82ccb32 commit 8caef80
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/parser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class VASTParser
for creativeElement in @childsByName(node, "Creative")
creativeAttributes =
id : creativeElement.getAttribute('id') or null
adId : creativeElement.getAttribute('adId') or null
adId : @parseCreativeAdIdAttribute(creativeElement)
sequence : creativeElement.getAttribute('sequence') or null
apiFramework : creativeElement.getAttribute('apiFramework') or null

Expand Down Expand Up @@ -563,4 +563,10 @@ class VASTParser
if attributeValue
nodeDestination.setAttribute attributeName, attributeValue

@parseCreativeAdIdAttribute: (creativeElement) ->
return creativeElement.getAttribute('AdID') or # VAST 2 spec
creativeElement.getAttribute('adID') or # VAST 3 spec
creativeElement.getAttribute('adId') or # VAST 4 spec
null

module.exports = VASTParser
10 changes: 8 additions & 2 deletions test/parser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ describe 'VASTParser', ->
it 'should have parsed AltText for companion and its equal', =>
companion.altText.should.equal 'Sample Alt Text Content!!!!'

it 'should have checked that AltText exists', =>
companion.should.have.property('altText')

it 'should have parsed AltText for companion and its equal', =>
companion.altText.should.equal 'Sample Alt Text Content!!!!'

it 'should have 1 companion clickthrough url', =>
companion.companionClickThroughURLTemplate.should.equal 'http://example.com/companion1-clickthrough'

Expand Down Expand Up @@ -420,8 +426,8 @@ describe 'VASTParser', ->
it 'should have an id', =>
linear.id.should.equal "id873421"

it 'should not have an adId', =>
should.equal linear.adId, null
it 'should have an adId', =>
linear.adId.should.equal "adId221144"

it 'should not have a sequence', =>
should.equal linear.sequence, null
Expand Down
4 changes: 2 additions & 2 deletions test/vastfiles/sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</Icons>
</Linear>
</Creative>
<Creative id="id130985" adId="adId345691" sequence="2" >
<Creative id="id130985" AdID="adId345691" sequence="2" >
<CompanionAds>
<Companion width="300" height="60">
<StaticResource creativeType="image/jpeg"><![CDATA[http://example.com/companion1-static-resource]]></StaticResource>
Expand Down Expand Up @@ -124,7 +124,7 @@
<AdTitle><![CDATA[Ad title 2]]></AdTitle>
<Impression><![CDATA[http://example.com/impression1]]></Impression>
<Creatives>
<Creative id="id873421" apiFramework="VPAID">
<Creative id="id873421" adID="adId221144" apiFramework="VPAID">
<Linear skipoffset="00:00:10" >
<Duration>30</Duration>
<MediaFiles>
Expand Down

0 comments on commit 8caef80

Please sign in to comment.