From d8a150a8a98b734cc48dae9688d1b47c7e385c28 Mon Sep 17 00:00:00 2001 From: "Collin Miller (Zardulist)" Date: Wed, 11 Jan 2017 11:25:11 -0600 Subject: [PATCH 01/13] find replace callback names --- elements/bulbs-carousel/bulbs-carousel.js | 4 +-- .../bulbs-carousel/bulbs-carousel.test.js | 12 +++---- elements/bulbs-carousel/buttons.js | 4 +-- elements/bulbs-carousel/item.js | 2 +- .../bulbs-cinemagraph/bulbs-cinemagraph.js | 6 ++-- .../bulbs-cinemagraph.test.js | 10 +++--- .../bulbs-clickventure/bulbs-clickventure.js | 2 +- elements/bulbs-content/bulbs-content.js | 2 +- elements/bulbs-content/bulbs-content.test.js | 6 ++-- elements/bulbs-datamap/bulbs-datamap.js | 2 +- elements/bulbs-dfp/bulbs-dfp.js | 4 +-- elements/bulbs-dfp/bulbs-dfp.test.js | 22 ++++++------ elements/bulbs-ellipsize/bulbs-ellipsize.js | 2 +- .../bulbs-flyover-menu/bulbs-flyover-menu.js | 12 +++---- .../bulbs-header-masthead-test.js | 8 ++--- .../bulbs-header/bulbs-header-masthead.js | 4 +-- elements/bulbs-header/bulbs-header.js | 2 +- .../bulbs-liveblog/bulbs-liveblog-entry.js | 4 +-- .../bulbs-liveblog-entry.test.js | 8 ++--- .../bulbs-liveblog-responses.js | 4 +-- elements/bulbs-liveblog/bulbs-liveblog.js | 6 ++-- .../bulbs-liveblog/bulbs-liveblog.test.js | 34 +++++++++---------- elements/bulbs-load-more/bulbs-load-more.js | 4 +-- elements/bulbs-page/bulbs-page.js | 4 +-- elements/bulbs-page/bulbs-page.test.js | 12 +++---- .../bulbs-pinned-element.js | 4 +-- .../bulbs-pinned-element.test.js | 4 +-- elements/bulbs-quiz/bulbs-quiz.js | 2 +- .../bulbs-reading-list/bulbs-reading-list.js | 2 +- .../components/bulbs-reading-list-articles.js | 2 +- .../components/bulbs-reading-list-item.js | 2 +- elements/bulbs-slideshow/bulbs-slideshow.js | 2 +- elements/bulbs-splitpic/bulbs-splitpic.js | 2 +- .../bulbs-video/elements/video-carousel.js | 2 +- .../elements/video-carousel.test.js | 8 ++--- .../campaign-brand-messaging.js | 4 +-- .../campaign-brand-messaging.test.js | 2 +- .../campaign-product-shot.js | 4 +-- .../campaign-product-shot.test.js | 2 +- elements/lazy-template/lazy-template.js | 4 +-- elements/lazy-template/lazy-template.test.js | 6 ++-- elements/progress-bar/progress-bar.js | 2 +- lib/bulbs-elements/register.js | 6 ++-- 43 files changed, 120 insertions(+), 120 deletions(-) diff --git a/elements/bulbs-carousel/bulbs-carousel.js b/elements/bulbs-carousel/bulbs-carousel.js index d70795db..1ad55cb4 100644 --- a/elements/bulbs-carousel/bulbs-carousel.js +++ b/elements/bulbs-carousel/bulbs-carousel.js @@ -6,7 +6,7 @@ import BulbsCarouselState from './bulbs-carousel-state'; import './bulbs-carousel.scss'; export default class BulbsCarousel extends BulbsHTMLElement { - createdCallback () { + constructor () { invariant( this.slider = this.querySelector('bulbs-carousel-slider'), ' MUST contain a element.' @@ -37,7 +37,7 @@ export default class BulbsCarousel extends BulbsHTMLElement { }); } - attachedCallback () { + connectedCallback () { this.state.pageToCarouselItem(this.state.getActiveCarouselItem()); this.applyState(); } diff --git a/elements/bulbs-carousel/bulbs-carousel.test.js b/elements/bulbs-carousel/bulbs-carousel.test.js index b06d9dd3..86ea4267 100644 --- a/elements/bulbs-carousel/bulbs-carousel.test.js +++ b/elements/bulbs-carousel/bulbs-carousel.test.js @@ -69,7 +69,7 @@ describe('', () => { document.body.removeChild(container); }); - describe('createdCallback', () => { + describe('constructor', () => { it('wraps slider content in a ', () => { expect(slider.childNodes).to.have.length(1); expect( @@ -91,7 +91,7 @@ describe('', () => { beforeEach(() => slider.remove()); it('throws an execption', () => { - expect(() => subject.createdCallback()).to.throw( + expect(() => subject.constructor()).to.throw( /MUST contain a / ); }); @@ -99,13 +99,13 @@ describe('', () => { context('called twice', () => { it('does not create a second track', () => { - subject.createdCallback(); + subject.constructor(); expect(subject.querySelector('bulbs-carousel-track bulbs-carousel-track')).to.be.null; }); }); }); - describe('attachedCallback', () => { + describe('connectedCallback', () => { context('there is an active carousel item', () => { beforeEach(() => { secondItem.setAttribute( @@ -114,7 +114,7 @@ describe('', () => { }); it('pages to the active item in the carousel', () => { - subject.attachedCallback(); + subject.connectedCallback(); expect(subject.state.pageToCarouselItem).to.have.been.calledWith( secondItem ); @@ -122,7 +122,7 @@ describe('', () => { }); it('applies state', () => { - subject.attachedCallback(); + subject.connectedCallback(); expect(subject.applyState).to.have.been.called; }); }); diff --git a/elements/bulbs-carousel/buttons.js b/elements/bulbs-carousel/buttons.js index b825b01c..90a681fb 100644 --- a/elements/bulbs-carousel/buttons.js +++ b/elements/bulbs-carousel/buttons.js @@ -1,13 +1,13 @@ import { BulbsHTMLElement, registerElement } from 'bulbs-elements/register'; export class NextButton extends BulbsHTMLElement { - createdCallback () { + constructor () { this.innerHTML = ''; } } export class PreviousButton extends BulbsHTMLElement { - createdCallback () { + constructor () { this.innerHTML = ''; } } diff --git a/elements/bulbs-carousel/item.js b/elements/bulbs-carousel/item.js index 69f2768f..2ed76df9 100644 --- a/elements/bulbs-carousel/item.js +++ b/elements/bulbs-carousel/item.js @@ -2,7 +2,7 @@ import { BulbsHTMLElement, registerElement } from 'bulbs-elements/register'; import { moveChildren, copyAttribute } from 'bulbs-elements/util'; export default class CarouselItem extends BulbsHTMLElement { - createdCallback () { + constructor () { if (this.getAttribute('href')) { let anchor = document.createElement('a'); diff --git a/elements/bulbs-cinemagraph/bulbs-cinemagraph.js b/elements/bulbs-cinemagraph/bulbs-cinemagraph.js index 3c5e0992..1d1b9a34 100644 --- a/elements/bulbs-cinemagraph/bulbs-cinemagraph.js +++ b/elements/bulbs-cinemagraph/bulbs-cinemagraph.js @@ -8,7 +8,7 @@ function BulbsHTMLVideoElement () {} BulbsHTMLVideoElement.prototype = HTMLVideoElement.prototype; class BulbsCinemagraph extends BulbsHTMLVideoElement { - createdCallback () { + constructor () { if (!this.hasAttribute('cinemagraph-duration')) { console.warn('is="bulbs-cinemagraph" elements should have a [cinemagraph-duration] attribute set'); } @@ -30,12 +30,12 @@ class BulbsCinemagraph extends BulbsHTMLVideoElement { this.addEventListener('exitviewport', () => this.pause()); } - attachedCallback () { + connectedCallback () { iphoneInlineVideo.default(this, /* hasAudio */ false); InViewMonitor.add(this); } - detachedCallback () { + disconnectedCallback () { InViewMonitor.remove(this); } } diff --git a/elements/bulbs-cinemagraph/bulbs-cinemagraph.test.js b/elements/bulbs-cinemagraph/bulbs-cinemagraph.test.js index 8b7a75eb..b26d80ba 100644 --- a/elements/bulbs-cinemagraph/bulbs-cinemagraph.test.js +++ b/elements/bulbs-cinemagraph/bulbs-cinemagraph.test.js @@ -33,24 +33,24 @@ describe('