Skip to content

Commit

Permalink
Rebase part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
glevitzky committed Aug 17, 2018
1 parent cd8ad41 commit 1f4b820
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
9 changes: 1 addition & 8 deletions extensions/amp-ad/0.1/amp-ad.js
Expand Up @@ -15,7 +15,6 @@

import {AmpAd3PImpl} from './amp-ad-3p-impl';
import {AmpAdCustom} from './amp-ad-custom';
import {AmpAdTemplate} from '../../amp-a4a/0.1/amp-ad-template';
import {CSS} from '../../../build/amp-ad-0.1.css';
import {Services} from '../../../src/services';
import {adConfig} from '../../../ads/_config';
Expand Down Expand Up @@ -59,20 +58,14 @@ export class AmpAd extends AMP.BaseElement {
const type = this.element.getAttribute('type');
return consent.then(() => {
const isCustom = type === 'custom';
const isTemplate = this.element.hasAttribute('template');
user().assert(isCustom || isTemplate || hasOwn(adConfig, type)
user().assert(isCustom || hasOwn(adConfig, type)
|| hasOwn(a4aRegistry, type), `Unknown ad type "${type}"`);

// Check for the custom ad type (no ad network, self-service)
if (isCustom) {
return new AmpAdCustom(this.element);
}

// Check for templatized amp-ad.
if (isTemplate) {
return new AmpAdTemplate(this.element);
}

this.win.ampAdSlotIdCounter = this.win.ampAdSlotIdCounter || 0;
const slotId = this.win.ampAdSlotIdCounter++;

Expand Down
8 changes: 0 additions & 8 deletions extensions/amp-ad/0.1/test/test-amp-ad.js
Expand Up @@ -16,7 +16,6 @@

import {AmpAd} from '../amp-ad';
import {AmpAd3PImpl} from '../amp-ad-3p-impl';
import {AmpAdTemplate} from '../../../amp-a4a/0.1/amp-ad-template';
import {Services} from '../../../../src/services';
import {adConfig} from '../../../../ads/_config';
import {getA4ARegistry} from '../../../../ads/_a4a-config';
Expand Down Expand Up @@ -114,13 +113,6 @@ describes.realWin('Ad loader', {amp: true}, env => {
});
});

it('uses AmpAdTemplate when template attribute is present', () => {
ampAdElement.setAttribute('template', true);
ampAdElement.setAttribute('type', 'test');
return expect(ampAd.upgradeCallback()).to.eventually.be
.instanceof(AmpAdTemplate);
});

it('fails upgrade on A4A upgrade with loadElementClass error', () => {
a4aRegistry['zort'] = function() {
return true;
Expand Down

0 comments on commit 1f4b820

Please sign in to comment.