-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support tree structure (ad buffet)
- Loading branch information
Showing
8 changed files
with
131 additions
and
60 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
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 |
---|---|---|
|
@@ -66,6 +66,7 @@ | |
"globals": [ | ||
"describe", | ||
"it", | ||
"xit", | ||
"before", | ||
"after", | ||
"beforeEach", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default class VASTTreeNode { | ||
constructor (vast, children = []) { | ||
this._vast = vast | ||
this._children = children | ||
} | ||
|
||
get vast () { | ||
return this._vast | ||
} | ||
|
||
get childNodes () { | ||
return this._children | ||
} | ||
|
||
get firstChild () { | ||
return this._children[0] | ||
} | ||
|
||
hasChildNodes () { | ||
return this._children.length > 0 | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<VAST version="2.0"> | ||
<Ad> | ||
<Wrapper> | ||
<VASTAdTagURI>http://demo.tremormedia.com/proddev/vast/vast_inline_linear.xml</VASTAdTagURI> | ||
</Wrapper> | ||
</Ad> | ||
<Ad> | ||
<Wrapper> | ||
<VASTAdTagURI>http://demo.tremormedia.com/proddev/vast/vast_inline_linear.xml</VASTAdTagURI> | ||
</Wrapper> | ||
</Ad> | ||
</VAST> |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<VAST version="2.0"/> |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import VASTLoaderError from '../../src/error' | ||
|
||
describe('VASTLoaderError', function () { | ||
describe('#code', function () { | ||
it('gets set from the constructor', function () { | ||
const error = new VASTLoaderError(301) | ||
expect(error.code).to.equal(301) | ||
}) | ||
}) | ||
|
||
describe('#message', function () { | ||
it('resolves from the code', function () { | ||
const error = new VASTLoaderError(301) | ||
expect(error.message).to.equal('Timeout.') | ||
}) | ||
}) | ||
|
||
describe('#cause', function () { | ||
it('gets set from the constructor', function () { | ||
const cause = new Error('Foo') | ||
const error = new VASTLoaderError(301, cause) | ||
expect(error.cause).to.equal(cause) | ||
}) | ||
}) | ||
|
||
describe('#$type', function () { | ||
it('is VASTLoaderError', function () { | ||
const error = new VASTLoaderError(900) | ||
expect(error.$type).to.equal('VASTLoaderError') | ||
}) | ||
}) | ||
}) |
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