"use strict";
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = require("path");
var MagicString = require("magic-string");
var decorators = require("./decorators");
var helpers = require("../util/helpers");
var baseDir = path_1.join(process.cwd(), 'myApp');
var ionicAngular = path_1.join(baseDir, 'node_modules', 'ionic-angular');
describe('optimization', function () {
    describe('purgeStaticFieldDecorators', function () {
        it('should remove the static decorators', function () {
            // arrange
            var decoratorStatement = "\n      import { Taco } from 'blah';\n      IonicModule.decorators = [\n    { type: NgModule, args: [{\n                imports: [BrowserModule, HttpModule, FormsModule, ReactiveFormsModule],\n                exports: [\n                    BrowserModule,\n                    HttpModule,\n                    FormsModule,\n                    ReactiveFormsModule,\n                    Avatar,\n                    Backdrop,\n                    Badge,\n                    Button,\n                    Card,\n                    CardContent,\n                    CardHeader,\n                    CardTitle,\n                    Checkbox,\n                    Chip,\n                    ClickBlock,\n                    Col,\n                    Content,\n                    // DateTime,\n                    FabContainer,\n                    FabButton,\n                    FabList,\n                    Footer,\n                    Grid,\n                    Header,\n                    HideWhen,\n                    Icon,\n                    Img,\n                    InfiniteScroll,\n                    InfiniteScrollContent,\n                    IonicApp,\n                    Item,\n                    ItemContent,\n                    ItemDivider,\n                    ItemGroup,\n                    ItemOptions,\n                    ItemReorder,\n                    ItemSliding,\n                    Label,\n                    List,\n                    ListHeader,\n                    Menu,\n                    MenuClose,\n                    MenuToggle,\n                    NativeInput,\n                    Nav,\n                    Navbar,\n                    NavPop,\n                    NavPopAnchor,\n                    NavPush,\n                    NavPushAnchor,\n                    NextInput,\n                    Note,\n                    Option,\n                    OverlayPortal,\n                    PickerColumnCmp,\n                    RadioButton,\n                    RadioGroup,\n                    Range,\n                    RangeKnob,\n                    Refresher,\n                    RefresherContent,\n                    Reorder,\n                    Row,\n                    Scroll,\n                    Searchbar,\n                    Segment,\n                    SegmentButton,\n                    // Select,\n                    ShowWhen,\n                    Slide,\n                    Slides,\n                    Spinner,\n                    Tab,\n                    Tabs,\n                    TabButton,\n                    TabHighlight,\n                    TextInput,\n                    Thumbnail,\n                    Toggle,\n                    Toolbar,\n                    ToolbarItem,\n                    ToolbarTitle,\n                    Typography,\n                    VirtualFooter,\n                    VirtualHeader,\n                    VirtualItem,\n                    VirtualScroll,\n                ],\n                declarations: [\n                    ActionSheetCmp,\n                    AlertCmp,\n                    ClickBlock,\n                    LoadingCmp,\n                    ModalCmp,\n                    PickerCmp,\n                    PopoverCmp,\n                    ToastCmp,\n                    Avatar,\n                    Backdrop,\n                    Badge,\n                    Button,\n                    Card,\n                    CardContent,\n                    CardHeader,\n                    CardTitle,\n                    Checkbox,\n                    Chip,\n                    ClickBlock,\n                    Col,\n                    Content,\n                    // DateTime,\n                    FabContainer,\n                    FabButton,\n                    FabList,\n                    Footer,\n                    Grid,\n                    Header,\n                    HideWhen,\n                    Icon,\n                    Img,\n                    InfiniteScroll,\n                    InfiniteScrollContent,\n                    IonicApp,\n                    Item,\n                    ItemContent,\n                    ItemDivider,\n                    ItemGroup,\n                    ItemOptions,\n                    ItemReorder,\n                    ItemSliding,\n                    Label,\n                    List,\n                    ListHeader,\n                    Menu,\n                    MenuClose,\n                    MenuToggle,\n                    NativeInput,\n                    Nav,\n                    Navbar,\n                    NavPop,\n                    NavPopAnchor,\n                    NavPush,\n                    NavPushAnchor,\n                    NextInput,\n                    Note,\n                    Option,\n                    OverlayPortal,\n                    PickerColumnCmp,\n                    RadioButton,\n                    RadioGroup,\n                    Range,\n                    RangeKnob,\n                    Refresher,\n                    RefresherContent,\n                    Reorder,\n                    Row,\n                    Scroll,\n                    Searchbar,\n                    Segment,\n                    SegmentButton,\n                    // Select,\n                    ShowWhen,\n                    Slide,\n                    Slides,\n                    Spinner,\n                    Tab,\n                    Tabs,\n                    TabButton,\n                    TabHighlight,\n                    TextInput,\n                    Thumbnail,\n                    Toggle,\n                    Toolbar,\n                    ToolbarItem,\n                    ToolbarTitle,\n                    Typography,\n                    VirtualFooter,\n                    VirtualHeader,\n                    VirtualItem,\n                    VirtualScroll,\n                ],\n                entryComponents: []\n            },] },\n];\n      ";
            var additionalGeneratedContent = "\n      /** @nocollapse */\nIonicModule.ctorParameters = () => [];\nfunction IonicModule_tsickle_Closure_declarations() {\n    /** @type {?} */\n    IonicModule.decorators;\n    /**\n     * @nocollapse\n     * @type {?}\n     */\n    IonicModule.ctorParameters;\n}\n** @nocollapse */\nLazyModule.ctorParameters = () => [];\nfunction LazyModule_tsickle_Closure_declarations() {\n    /** @type {?} */\n    LazyModule.decorators;\n    /**\n     * @nocollapse\n     * @type {?}\n     */\n    LazyModule.ctorParameters;\n}\n      ";
            var knownContent = "\n      some various content\n" + decoratorStatement + "\n" + additionalGeneratedContent + "\n\nsome more content\n      ";
            // act
            var magicString = new MagicString(knownContent);
            var entryPoint = path_1.join(ionicAngular, 'index.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeStaticFieldDecorators(entryPoint, knownContent, magicString);
            var result = magicString.toString();
            // assert
            expect(result).not.toEqual(knownContent);
            expect(result.indexOf(decoratorStatement)).toEqual(-1);
        });
        it('should not remove decorators when it has an injectable statement in it', function () {
            var knownContent = "\nvar ActionSheetController = (function () {\n    /**\n     * @param {?} _app\n     * @param {?} config\n     */\n    function ActionSheetController(_app, config) {\n        this._app = _app;\n        this.config = config;\n    }\n    /**\n     * Open an action sheet with a title, subTitle, and an array of buttons\n     * @param {?=} opts\n     * @return {?}\n     */\n    ActionSheetController.prototype.create = function (opts) {\n        if (opts === void 0) { opts = {}; }\n        return new ActionSheet(this._app, opts, this.config);\n    };\n    return ActionSheetController;\n}());\nexport { ActionSheetController };\nActionSheetController.decorators = [\n    { type: Injectable },\n];\n/**\n * @nocollapse\n */\nActionSheetController.ctorParameters = function () { return [\n    { type: App, },\n    { type: Config, },\n]; };\n        ";
            var magicString = new MagicString(knownContent);
            var entryPoint = path_1.join(ionicAngular, 'index.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeStaticFieldDecorators(entryPoint, knownContent, magicString);
            var result = magicString.toString();
            expect(result).toEqual(knownContent);
        });
        it('should work with the ionic-angular index file', function () {
            var ionicModuleDecorator = "\nIonicModule.decorators = [\n    { type: NgModule, args: [{\n                imports: [\n                    CommonModule,\n                    FormsModule,\n                    ReactiveFormsModule,\n                    ActionSheetModule.forRoot(),\n                    AlertModule.forRoot(),\n                    AppModule.forRoot(),\n                    AvatarModule.forRoot(),\n                    BackdropModule.forRoot(),\n                    BadgeModule.forRoot(),\n                    ButtonModule.forRoot(),\n                    CardModule.forRoot(),\n                    CheckboxModule.forRoot(),\n                    ChipModule.forRoot(),\n                    ClickBlockModule.forRoot(),\n                    ContentModule.forRoot(),\n                    DateTimeModule.forRoot(),\n                    FabModule.forRoot(),\n                    GridModule.forRoot(),\n                    IconModule.forRoot(),\n                    ImgModule.forRoot(),\n                    InfiniteScrollModule.forRoot(),\n                    InputModule.forRoot(),\n                    ItemModule.forRoot(),\n                    LabelModule.forRoot(),\n                    ListModule.forRoot(),\n                    LoadingModule.forRoot(),\n                    MenuModule.forRoot(),\n                    ModalModule.forRoot(),\n                    NavModule.forRoot(),\n                    NavbarModule.forRoot(),\n                    NoteModule.forRoot(),\n                    OptionModule.forRoot(),\n                    PickerModule.forRoot(),\n                    PopoverModule.forRoot(),\n                    RadioModule.forRoot(),\n                    RangeModule.forRoot(),\n                    RefresherModule.forRoot(),\n                    ScrollModule.forRoot(),\n                    SearchbarModule.forRoot(),\n                    SegmentModule.forRoot(),\n                    SelectModule.forRoot(),\n                    ShowHideWhenModule.forRoot(),\n                    SlidesModule.forRoot(),\n                    SpinnerModule.forRoot(),\n                    SplitPaneModule.forRoot(),\n                    TabsModule.forRoot(),\n                    ThumbnailModule.forRoot(),\n                    ToastModule.forRoot(),\n                    ToggleModule.forRoot(),\n                    ToolbarModule.forRoot(),\n                    TypographyModule.forRoot(),\n                    VirtualScrollModule.forRoot()\n                ],\n                exports: [\n                    CommonModule,\n                    FormsModule,\n                    ReactiveFormsModule,\n                    ActionSheetModule,\n                    AlertModule,\n                    AppModule,\n                    AvatarModule,\n                    BackdropModule,\n                    BadgeModule,\n                    ButtonModule,\n                    CardModule,\n                    CheckboxModule,\n                    ChipModule,\n                    ClickBlockModule,\n                    ContentModule,\n                    DateTimeModule,\n                    FabModule,\n                    GridModule,\n                    IconModule,\n                    ImgModule,\n                    InfiniteScrollModule,\n                    InputModule,\n                    ItemModule,\n                    LabelModule,\n                    ListModule,\n                    LoadingModule,\n                    MenuModule,\n                    ModalModule,\n                    NavModule,\n                    NavbarModule,\n                    NoteModule,\n                    OptionModule,\n                    PickerModule,\n                    PopoverModule,\n                    RadioModule,\n                    RangeModule,\n                    RefresherModule,\n                    ScrollModule,\n                    SearchbarModule,\n                    SegmentModule,\n                    SelectModule,\n                    ShowHideWhenModule,\n                    SlidesModule,\n                    SpinnerModule,\n                    SplitPaneModule,\n                    TabsModule,\n                    ThumbnailModule,\n                    ToastModule,\n                    ToggleModule,\n                    ToolbarModule,\n                    TypographyModule,\n                    VirtualScrollModule\n                ]\n            },] },\n];\n        ";
            var knownContent = "\nimport { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ComponentFactoryResolver, Inject, Injector, NgModule, NgZone, Optional } from '@angular/core';\nimport { APP_BASE_HREF, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, PlatformLocation } from '@angular/common';\nimport { DOCUMENT } from '@angular/platform-browser';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\nimport { ActionSheetController } from './components/action-sheet/action-sheet-controller';\nimport { AlertController } from './components/alert/alert-controller';\nimport { App } from './components/app/app';\nimport { AppRootToken } from './components/app/app-root';\nimport { Config, setupConfig, ConfigToken } from './config/config';\nimport { DeepLinker, setupDeepLinker } from './navigation/deep-linker';\nimport { DomController } from './platform/dom-controller';\nimport { Events, setupProvideEvents } from './util/events';\nimport { Form } from './util/form';\nimport { GestureController } from './gestures/gesture-controller';\nimport { Haptic } from './tap-click/haptic';\nimport { Keyboard } from './platform/keyboard';\nimport { LoadingController } from './components/loading/loading-controller';\nimport { MenuController } from './components/menu/menu-controller';\nimport { ModalController } from './components/modal/modal-controller';\nimport { ModuleLoader, provideModuleLoader, setupPreloading, LAZY_LOADED_TOKEN } from './util/module-loader';\nimport { NgModuleLoader } from './util/ng-module-loader';\nimport { PickerController } from './components/picker/picker-controller';\nimport { Platform, setupPlatform } from './platform/platform';\nimport { PlatformConfigToken, providePlatformConfigs } from './platform/platform-registry';\nimport { PopoverController } from './components/popover/popover-controller';\nimport { TapClick, setupTapClick } from './tap-click/tap-click';\nimport { ToastController } from './components/toast/toast-controller';\nimport { registerModeConfigs } from './config/mode-registry';\nimport { TransitionController } from './transitions/transition-controller';\nimport { UrlSerializer, setupUrlSerializer, DeepLinkConfigToken } from './navigation/url-serializer';\n\nimport { ActionSheetModule } from './components/action-sheet/action-sheet.module';\nimport { AlertModule } from './components/alert/alert.module';\nimport { AppModule } from './components/app/app.module';\nimport { AvatarModule } from './components/avatar/avatar.module';\nimport { BackdropModule } from './components/backdrop/backdrop.module';\nimport { BadgeModule } from './components/badge/badge.module';\nimport { ButtonModule } from './components/button/button.module';\nimport { CardModule } from './components/card/card.module';\nimport { CheckboxModule } from './components/checkbox/checkbox.module';\nimport { ChipModule } from './components/chip/chip.module';\nimport { ClickBlockModule } from './components/click-block/click-block.module';\nimport { ContentModule } from './components/content/content.module';\nimport { DateTimeModule } from './components/datetime/datetime.module';\nimport { FabModule } from './components/fab/fab.module';\nimport { GridModule } from './components/grid/grid.module';\nimport { IconModule } from './components/icon/icon.module';\nimport { ImgModule } from './components/img/img.module';\nimport { InfiniteScrollModule } from './components/infinite-scroll/infinite-scroll.module';\nimport { InputModule } from './components/input/input.module';\nimport { ItemModule } from './components/item/item.module';\nimport { LabelModule } from './components/label/label.module';\nimport { ListModule } from './components/list/list.module';\nimport { LoadingModule } from './components/loading/loading.module';\nimport { MenuModule } from './components/menu/menu.module';\nimport { ModalModule } from './components/modal/modal.module';\nimport { NavModule } from './components/nav/nav.module';\nimport { NavbarModule } from './components/navbar/navbar.module';\nimport { NoteModule } from './components/note/note.module';\nimport { OptionModule } from './components/option/option.module';\nimport { PickerModule } from './components/picker/picker.module';\nimport { PopoverModule } from './components/popover/popover.module';\nimport { RadioModule } from './components/radio/radio.module';\nimport { RangeModule } from './components/range/range.module';\nimport { RefresherModule } from './components/refresher/refresher.module';\nimport { ScrollModule } from './components/scroll/scroll.module';\nimport { SearchbarModule } from './components/searchbar/searchbar.module';\nimport { SegmentModule } from './components/segment/segment.module';\nimport { SelectModule } from './components/select/select.module';\nimport { ShowHideWhenModule } from './components/show-hide-when/show-hide-when.module';\nimport { SlidesModule } from './components/slides/slides.module';\nimport { SpinnerModule } from './components/spinner/spinner.module';\nimport { SplitPaneModule } from './components/split-pane/split-pane.module';\nimport { TabsModule } from './components/tabs/tabs.module';\nimport { ThumbnailModule } from './components/thumbnail/thumbnail.module';\nimport { ToastModule } from './components/toast/toast.module';\nimport { ToggleModule } from './components/toggle/toggle.module';\nimport { ToolbarModule } from './components/toolbar/toolbar.module';\nimport { TypographyModule } from './components/typography/typography.module';\nimport { VirtualScrollModule } from './components/virtual-scroll/virtual-scroll.module';\n\nexport { ActionSheetModule } from './components/action-sheet/action-sheet.module';\nexport { AlertModule } from './components/alert/alert.module';\nexport { AppModule } from './components/app/app.module';\nexport { AvatarModule } from './components/avatar/avatar.module';\nexport { BackdropModule } from './components/backdrop/backdrop.module';\nexport { BadgeModule } from './components/badge/badge.module';\nexport { ButtonModule } from './components/button/button.module';\nexport { CardModule } from './components/card/card.module';\nexport { CheckboxModule } from './components/checkbox/checkbox.module';\nexport { ChipModule } from './components/chip/chip.module';\nexport { ClickBlockModule } from './components/click-block/click-block.module';\nexport { ContentModule } from './components/content/content.module';\nexport { DateTimeModule } from './components/datetime/datetime.module';\nexport { FabModule } from './components/fab/fab.module';\nexport { GridModule } from './components/grid/grid.module';\nexport { IconModule } from './components/icon/icon.module';\nexport { ImgModule } from './components/img/img.module';\nexport { InfiniteScrollModule } from './components/infinite-scroll/infinite-scroll.module';\nexport { InputModule } from './components/input/input.module';\nexport { ItemModule } from './components/item/item.module';\nexport { LabelModule } from './components/label/label.module';\nexport { ListModule } from './components/list/list.module';\nexport { LoadingModule } from './components/loading/loading.module';\nexport { MenuModule } from './components/menu/menu.module';\nexport { ModalModule } from './components/modal/modal.module';\nexport { NavModule } from './components/nav/nav.module';\nexport { NavbarModule } from './components/navbar/navbar.module';\nexport { NoteModule } from './components/note/note.module';\nexport { OptionModule } from './components/option/option.module';\nexport { PickerModule } from './components/picker/picker.module';\nexport { PopoverModule } from './components/popover/popover.module';\nexport { RadioModule } from './components/radio/radio.module';\nexport { RangeModule } from './components/range/range.module';\nexport { RefresherModule } from './components/refresher/refresher.module';\nexport { ScrollModule } from './components/scroll/scroll.module';\nexport { SearchbarModule } from './components/searchbar/searchbar.module';\nexport { SegmentModule } from './components/segment/segment.module';\nexport { SelectModule } from './components/select/select.module';\nexport { ShowHideWhenModule } from './components/show-hide-when/show-hide-when.module';\nexport { SlidesModule } from './components/slides/slides.module';\nexport { SpinnerModule } from './components/spinner/spinner.module';\nexport { SplitPaneModule } from './components/split-pane/split-pane.module';\nexport { TabsModule } from './components/tabs/tabs.module';\nexport { ThumbnailModule } from './components/thumbnail/thumbnail.module';\nexport { ToastModule } from './components/toast/toast.module';\nexport { ToggleModule } from './components/toggle/toggle.module';\nexport { ToolbarModule } from './components/toolbar/toolbar.module';\nexport { TypographyModule } from './components/typography/typography.module';\nexport { VirtualScrollModule } from './components/virtual-scroll/virtual-scroll.module';\n\nexport { ActionSheet } from './components/action-sheet/action-sheet';\nexport { ActionSheetController } from './components/action-sheet/action-sheet-controller';\nexport { AlertController } from './components/alert/alert-controller';\nexport { Alert } from './components/alert/alert';\nexport { App } from './components/app/app';\nexport { Avatar } from './components/avatar/avatar';\nexport { Backdrop } from './components/backdrop/backdrop';\nexport { Badge } from './components/badge/badge';\nexport { Button } from './components/button/button';\nexport { Card } from './components/card/card';\nexport { CardContent } from './components/card/card-content';\nexport { CardHeader } from './components/card/card-header';\nexport { CardTitle } from './components/card/card-title';\nexport { Checkbox } from './components/checkbox/checkbox';\nexport { Chip } from './components/chip/chip';\nexport { ClickBlock } from './components/click-block/click-block';\nexport { Content } from './components/content/content';\nexport { DateTime } from './components/datetime/datetime';\nexport { FabButton } from './components/fab/fab';\nexport { FabContainer } from './components/fab/fab-container';\nexport { FabList } from './components/fab/fab-list';\nexport { Col } from './components/grid/col';\nexport { Grid } from './components/grid/grid';\nexport { Row } from './components/grid/row';\nexport { Ion } from './components/ion';\nexport { Icon } from './components/icon/icon';\nexport { Img } from './components/img/img';\nexport { InfiniteScroll } from './components/infinite-scroll/infinite-scroll';\nexport { InfiniteScrollContent } from './components/infinite-scroll/infinite-scroll-content';\nexport { TextInput } from './components/input/input';\nexport { IonicApp } from './components/app/app-root';\nexport { Item } from './components/item/item';\nexport { ItemContent } from './components/item/item-content';\nexport { ItemDivider } from './components/item/item-divider';\nexport { ItemGroup } from './components/item/item-group';\nexport { ItemReorder } from './components/item/item-reorder';\nexport { Reorder } from './components/item/reorder';\nexport { ItemSliding } from './components/item/item-sliding';\nexport { ItemOptions } from './components/item/item-options';\nexport { Label } from './components/label/label';\nexport { List } from './components/list/list';\nexport { ListHeader } from './components/list/list-header';\nexport { Loading } from './components/loading/loading';\nexport { LoadingController } from './components/loading/loading-controller';\nexport { Menu } from './components/menu/menu';\nexport { MenuClose } from './components/menu/menu-close';\nexport { MenuController } from './components/menu/menu-controller';\nexport { MenuToggle } from './components/menu/menu-toggle';\nexport { MenuType } from './components/menu/menu-types';\nexport { Modal } from './components/modal/modal';\nexport { ModalController } from './components/modal/modal-controller';\nexport { Nav } from './components/nav/nav';\nexport { NavPop } from './components/nav/nav-pop';\nexport { NavPopAnchor } from './components/nav/nav-pop-anchor';\nexport { NavPush } from './components/nav/nav-push';\nexport { NavPushAnchor } from './components/nav/nav-push-anchor';\nexport { Navbar } from './components/navbar/navbar';\nexport { NativeInput } from './components/input/native-input';\nexport { NextInput } from './components/input/next-input';\nexport { Note } from './components/note/note';\nexport { Option } from './components/option/option';\nexport { OverlayPortal } from './components/nav/overlay-portal';\nexport { Picker } from './components/picker/picker';\nexport { PickerController } from './components/picker/picker-controller';\nexport { Popover } from './components/popover/popover';\nexport { PopoverController } from './components/popover/popover-controller';\nexport { RadioButton } from './components/radio/radio-button';\nexport { RadioGroup } from './components/radio/radio-group';\nexport { Range } from './components/range/range';\nexport { RangeKnob } from './components/range/range-knob';\nexport { Refresher } from './components/refresher/refresher';\nexport { RefresherContent } from './components/refresher/refresher-content';\nexport { Scroll } from './components/scroll/scroll';\nexport { Searchbar } from './components/searchbar/searchbar';\nexport { Segment } from './components/segment/segment';\nexport { SegmentButton } from './components/segment/segment-button';\nexport { Select } from './components/select/select';\nexport { ShowWhen } from './components/show-hide-when/show-when';\nexport { DisplayWhen } from './components/show-hide-when/display-when';\nexport { HideWhen } from './components/show-hide-when/hide-when';\nexport { Slide } from './components/slides/slide';\nexport { Slides } from './components/slides/slides';\nexport { Spinner } from './components/spinner/spinner';\nexport { SplitPane, RootNode } from './components/split-pane/split-pane';\nexport { Tab } from './components/tabs/tab';\nexport { TabButton } from './components/tabs/tab-button';\nexport { TabHighlight } from './components/tabs/tab-highlight';\nexport { Tabs } from './components/tabs/tabs';\nexport { TapClick, setupTapClick, isActivatable } from './tap-click/tap-click';\nexport { Toast } from './components/toast/toast';\nexport { ToastController } from './components/toast/toast-controller';\nexport { Toggle } from './components/toggle/toggle';\nexport { ToolbarBase } from './components/toolbar/toolbar-base';\nexport { Toolbar } from './components/toolbar/toolbar';\nexport { Header } from './components/toolbar/toolbar-header';\nexport { Footer } from './components/toolbar/toolbar-footer';\nexport { ToolbarItem } from './components/toolbar/toolbar-item';\nexport { ToolbarTitle } from './components/toolbar/toolbar-title';\nexport { Thumbnail } from './components/thumbnail/thumbnail';\nexport { Typography } from './components/typography/typography';\nexport { VirtualScroll } from './components/virtual-scroll/virtual-scroll';\n\nexport { Config, setupConfig, ConfigToken } from './config/config';\nexport { DomController } from './platform/dom-controller';\nexport { Platform, setupPlatform } from './platform/platform';\nexport { Haptic } from './tap-click/haptic';\nexport { DeepLinker } from './navigation/deep-linker';\nexport { IonicPage } from './navigation/ionic-page';\nexport { NavController } from './navigation/nav-controller';\nexport { NavControllerBase } from './navigation/nav-controller-base';\nexport { NavParams } from './navigation/nav-params';\nexport { DeepLinkMetadata, DeepLinkMetadataFactory } from './navigation/nav-util';\nexport { UrlSerializer, DeepLinkConfigToken } from './navigation/url-serializer';\nexport { ViewController } from './navigation/view-controller';\nexport { ActionSheetCmp } from './components/action-sheet/action-sheet-component';\nexport { AlertCmp } from './components/alert/alert-component';\nexport { LoadingCmp } from './components/loading/loading-component';\nexport { ModalCmp } from './components/modal/modal-component';\nexport { PickerCmp } from './components/picker/picker-component';\nexport { PickerColumnCmp } from './components/picker/picker-column';\nexport { PopoverCmp } from './components/popover/popover-component';\nexport { ToastCmp } from './components/toast/toast-component';\n\nexport { PanGesture } from './gestures/drag-gesture';\nexport { Gesture } from './gestures/gesture';\nexport { SlideEdgeGesture } from './gestures/slide-edge-gesture';\nexport { SlideGesture } from './gestures/slide-gesture';\nexport { BLOCK_ALL, GESTURE_GO_BACK_SWIPE, GESTURE_MENU_SWIPE, GESTURE_ITEM_SWIPE, GESTURE_REFRESHER, GESTURE_TOGGLE, GestureController, GestureDelegate, BlockerDelegate, } from './gestures/gesture-controller';\nexport { Events, setupEvents, setupProvideEvents } from './util/events';\nexport { IonicErrorHandler } from './util/ionic-error-handler';\nexport { Keyboard } from './platform/keyboard';\nexport { Form, IonicFormInput, IonicTapInput } from './util/form';\nexport { reorderArray } from './util/util';\nexport { Animation } from './animations/animation';\nexport { PageTransition } from './transitions/page-transition';\nexport { Transition } from './transitions/transition';\nexport { PlatformConfigToken } from './platform/platform-registry';\nexport { registerModeConfigs } from './config/mode-registry';\nexport { IonicGestureConfig } from './gestures/gesture-config';\n\nexport class IonicModule {\n\n    static forRoot(appRoot, config = null, deepLinkConfig = null) {\n        return {\n            ngModule: IonicModule,\n            providers: [\n                // useValue: bootstrap values\n                { provide: AppRootToken, useValue: appRoot },\n                { provide: ConfigToken, useValue: config },\n                { provide: DeepLinkConfigToken, useValue: deepLinkConfig },\n                { provide: APP_BASE_HREF, useValue: '/' },\n                // useFactory: user values\n                { provide: PlatformConfigToken, useFactory: providePlatformConfigs },\n                // useFactory: ionic core providers\n                { provide: Platform, useFactory: setupPlatform, deps: [DOCUMENT, PlatformConfigToken, NgZone] },\n                { provide: Config, useFactory: setupConfig, deps: [ConfigToken, Platform] },\n                // useFactory: ionic app initializers\n                { provide: APP_INITIALIZER, useFactory: registerModeConfigs, deps: [Config], multi: true },\n                { provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [Platform, DomController], multi: true },\n                { provide: APP_INITIALIZER, useFactory: setupTapClick, deps: [Config, Platform, DomController, App, NgZone, GestureController], multi: true },\n                { provide: APP_INITIALIZER, useFactory: setupPreloading, deps: [Config, DeepLinkConfigToken, ModuleLoader, NgZone], multi: true },\n                // useClass\n                // { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig },\n                // useValue\n                { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: appRoot, multi: true },\n                // ionic providers\n                ActionSheetController,\n                AlertController,\n                App,\n                DomController,\n                Events,\n                Form,\n                GestureController,\n                Haptic,\n                Keyboard,\n                LoadingController,\n                Location,\n                MenuController,\n                ModalController,\n                PickerController,\n                PopoverController,\n                NgModuleLoader,\n                TapClick,\n                ToastController,\n                TransitionController,\n                { provide: ModuleLoader, useFactory: provideModuleLoader, deps: [NgModuleLoader, Injector] },\n                { provide: LocationStrategy, useFactory: provideLocationStrategy, deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], Config] },\n                { provide: UrlSerializer, useFactory: setupUrlSerializer, deps: [DeepLinkConfigToken] },\n                { provide: DeepLinker, useFactory: setupDeepLinker, deps: [App, UrlSerializer, Location, ModuleLoader, ComponentFactoryResolver] },\n            ]\n        };\n    }\n}\n" + ionicModuleDecorator + "\n\nIonicModule.ctorParameters = () => [];\nfunction IonicModule_tsickle_Closure_declarations() {\n    IonicModule.decorators;\n    IonicModule.ctorParameters;\n}\n\nexport class IonicPageModule {\n\n    static forChild(page) {\n        return {\n            ngModule: IonicPageModule,\n            providers: [\n                { provide: (LAZY_LOADED_TOKEN), useValue: page },\n                { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: page, multi: true },\n            ]\n        };\n    }\n}\nIonicPageModule.decorators = [\n    { type: NgModule, args: [{\n                imports: [IonicModule],\n                exports: [IonicModule]\n            },] },\n];\n\nIonicPageModule.ctorParameters = () => [];\nfunction IonicPageModule_tsickle_Closure_declarations() {\n    IonicPageModule.decorators;\n    IonicPageModule.ctorParameters;\n}\n\nexport function provideLocationStrategy(platformLocationStrategy, baseHref, config) {\n    return config.get('locationStrategy') === 'path' ?\n        new PathLocationStrategy(platformLocationStrategy, baseHref) :\n        new HashLocationStrategy(platformLocationStrategy, baseHref);\n}\n//# sourceMappingURL=index.js.map\n";
            var magicString = new MagicString(knownContent);
            var entryPoint = path_1.join(ionicAngular, 'index.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeStaticFieldDecorators(entryPoint, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(ionicModuleDecorator)).toEqual(-1);
        });
        it('should process component file correctly', function () {
            var propDecorators = "\nActionSheetCmp.propDecorators = {\n    'keyUp': [{ type: HostListener, args: ['body:keyup', ['$event'],] },],\n};\n";
            var decoratorContent = "\nActionSheetCmp.decorators = [\n    { type: Component, args: [{\n                selector: 'ion-action-sheet',\n                template: '<ion-backdrop (click)=\"bdClick()\" [class.backdrop-no-tappable]=\"!d.enableBackdropDismiss\"></ion-backdrop>' +\n                    '<div class=\"action-sheet-wrapper\">' +\n                    '<div class=\"action-sheet-container\">' +\n                    '<div class=\"action-sheet-group\">' +\n                    '<div class=\"action-sheet-title\" id=\"{{hdrId}}\" *ngIf=\"d.title\">{{d.title}}</div>' +\n                    '<div class=\"action-sheet-sub-title\" id=\"{{descId}}\" *ngIf=\"d.subTitle\">{{d.subTitle}}</div>' +\n                    '<button ion-button=\"action-sheet-button\" (click)=\"click(b)\" *ngFor=\"let b of d.buttons\" class=\"disable-hover\" [attr.icon-left]=\"b.icon ? '' : null\" [ngClass]=\"b.cssClass\">' +\n                    '<ion-icon [name]=\"b.icon\" *ngIf=\"b.icon\" class=\"action-sheet-icon\"></ion-icon>' +\n                    '{{b.text}}' +\n                    '</button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group\" *ngIf=\"d.cancelButton\">' +\n                    '<button ion-button=\"action-sheet-button\" (click)=\"click(d.cancelButton)\" class=\"action-sheet-cancel disable-hover\" [attr.icon-left]=\"d.cancelButton.icon ? '' : null\" [ngClass]=\"d.cancelButton.cssClass\">' +\n                    '<ion-icon [name]=\"d.cancelButton.icon\" *ngIf=\"d.cancelButton.icon\" class=\"action-sheet-icon\"></ion-icon>' +\n                    '{{d.cancelButton.text}}' +\n                    '</button>' +\n                    '</div>' +\n                    '</div>' +\n                    '</div>',\n                host: {\n                    'role': 'dialog',\n                    '[attr.aria-labelledby]': 'hdrId',\n                    '[attr.aria-describedby]': 'descId'\n                },\n                encapsulation: ViewEncapsulation.None,\n            },] },\n];\n        ";
            var knownContent = "\nimport { Component, ElementRef, HostListener, Renderer, ViewEncapsulation } from '@angular/core';\nimport { GestureController, BLOCK_ALL } from '../../gestures/gesture-controller';\nimport { Config } from '../../config/config';\nimport { KEY_ESCAPE } from '../../platform/key';\nimport { Platform } from '../../platform/platform';\nimport { NavParams } from '../../navigation/nav-params';\nimport { ViewController } from '../../navigation/view-controller';\n\nexport class ActionSheetCmp {\n\n    constructor(_viewCtrl, config, _plt, _elementRef, gestureCtrl, params, renderer) {\n        this._viewCtrl = _viewCtrl;\n        this._plt = _plt;\n        this._elementRef = _elementRef;\n        this.gestureBlocker = gestureCtrl.createBlocker(BLOCK_ALL);\n        this.d = params.data;\n        this.mode = config.get('mode');\n        renderer.setElementClass(_elementRef.nativeElement, `action-sheet-" + _this.mode + "`, true);\n        if (this.d.cssClass) {\n            this.d.cssClass.split(' ').forEach(cssClass => {\n                // Make sure the class isn't whitespace, otherwise it throws exceptions\n                if (cssClass.trim() !== '')\n                    renderer.setElementClass(_elementRef.nativeElement, cssClass, true);\n            });\n        }\n        this.id = (++actionSheetIds);\n        if (this.d.title) {\n            this.hdrId = 'acst-hdr-' + this.id;\n        }\n        if (this.d.subTitle) {\n            this.descId = 'acst-subhdr-' + this.id;\n        }\n    }\n\n    ionViewDidLoad() {\n        // normalize the data\n        let  buttons = [];\n        this.d.buttons.forEach((button) => {\n            if (typeof button === 'string') {\n                button = { text: button };\n            }\n            if (!button.cssClass) {\n                button.cssClass = '';\n            }\n            if (button.role === 'cancel') {\n                this.d.cancelButton = button;\n            }\n            else {\n                if (button.role === 'destructive') {\n                    button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-destructive';\n                }\n                else if (button.role === 'selected') {\n                    button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-selected';\n                }\n                buttons.push(button);\n            }\n        });\n        this.d.buttons = buttons;\n    }\n\n    ionViewWillEnter() {\n        this.gestureBlocker.block();\n    }\n\n    ionViewDidLeave() {\n        this.gestureBlocker.unblock();\n    }\n\n    ionViewDidEnter() {\n        this._plt.focusOutActiveElement();\n        const  focusableEle = this._elementRef.nativeElement.querySelector('button');\n        if (focusableEle) {\n            focusableEle.focus();\n        }\n        this.enabled = true;\n    }\n\n    keyUp(ev) {\n        if (this.enabled && ev.keyCode === KEY_ESCAPE && this._viewCtrl.isLast()) {\n            (void 0) ;\n            this.bdClick();\n        }\n    }\n\n    click(button) {\n        if (!this.enabled) {\n            return;\n        }\n        let shouldDismiss = true;\n        if (button.handler) {\n            // a handler has been provided, execute it\n            if (button.handler() === false) {\n                // if the return value of the handler is false then do not dismiss\n                shouldDismiss = false;\n            }\n        }\n        if (shouldDismiss) {\n            this.dismiss(button.role);\n        }\n    }\n\n    bdClick() {\n        if (this.enabled && this.d.enableBackdropDismiss) {\n            if (this.d.cancelButton) {\n                this.click(this.d.cancelButton);\n            }\n            else {\n                this.dismiss('backdrop');\n            }\n        }\n    }\n\n    dismiss(role) {\n        const  opts = {\n            minClickBlockDuration: 400\n        };\n        return this._viewCtrl.dismiss(null, role, opts);\n    }\n\n    ngOnDestroy() {\n        (void 0);\n        this.d = null;\n        this.gestureBlocker.destroy();\n    }\n}\n" + decoratorContent + "\n\nActionSheetCmp.ctorParameters = () => [\n    { type: ViewController, },\n    { type: Config, },\n    { type: Platform, },\n    { type: ElementRef, },\n    { type: GestureController, },\n    { type: NavParams, },\n    { type: Renderer, },\n];\n" + propDecorators + "\nfunction ActionSheetCmp_tsickle_Closure_declarations() {\n\n    ActionSheetCmp.decorators;\n\n    ActionSheetCmp.ctorParameters;\n\n    ActionSheetCmp.propDecorators;\n\n    ActionSheetCmp.prototype.d;\n\n    ActionSheetCmp.prototype.descId;\n\n    ActionSheetCmp.prototype.enabled;\n\n    ActionSheetCmp.prototype.hdrId;\n\n    ActionSheetCmp.prototype.id;\n\n    ActionSheetCmp.prototype.mode;\n\n    ActionSheetCmp.prototype.gestureBlocker;\n\n    ActionSheetCmp.prototype._viewCtrl;\n\n    ActionSheetCmp.prototype._plt;\n\n    ActionSheetCmp.prototype._elementRef;\n}\nlet actionSheetIds = -1;\n//# sourceMappingURL=action-sheet-component.js.map\n";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'action-sheet', 'action-sheet-component.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeStaticFieldDecorators(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(decoratorContent)).toEqual(-1);
            expect(result.indexOf(propDecorators)).toEqual(-1);
        });
    });
    describe('purgeTranspiledDecorators', function () {
        it('should purge out transpiled decorators', function () {
            var inputDecorator = "\n__decorate([\n    Input(),\n    __metadata(\"design:type\", String)\n], AboutPage.prototype, \"someVariable\", void 0);\n        ";
            var outputDecorator = "\n__decorate([\n    Output(),\n    __metadata(\"design:type\", typeof (_a = typeof EventEmitter !== \"undefined\" && EventEmitter) === \"function\" && _a || Object)\n], AboutPage.prototype, \"emitter\", void 0);\n        ";
            var viewChildDecorator = "\n__decorate([\n    ViewChild('test', { read: ElementRef }),\n    __metadata(\"design:type\", Object)\n], AboutPage.prototype, \"test\", void 0);\n        ";
            var viewChildrenDecorator = "\n__decorate([\n    ViewChildren('test'),\n    __metadata(\"design:type\", Object)\n], AboutPage.prototype, \"tests\", void 0);\n        ";
            var hostBindingDecorator = "\n__decorate([\n    HostBinding('class.searchbar-has-focus'),\n    __metadata(\"design:type\", Boolean)\n], AboutPage.prototype, \"_sbHasFocus\", void 0);\n        ";
            var hostListenerDecorator = "\n__decorate([\n    HostListener('click', ['$event']),\n    __metadata(\"design:type\", Function),\n    __metadata(\"design:paramtypes\", [Object]),\n    __metadata(\"design:returntype\", void 0)\n], AboutPage.prototype, \"someFunction\", null);\n        ";
            var classDecorators = "\nAboutPage = __decorate([\n    IonicPage(),\n    Component({\n        selector: 'page-about',\n        templateUrl: 'about.html'\n    }),\n    __metadata(\"design:paramtypes\", [typeof (_b = typeof NavController !== \"undefined\" && NavController) === \"function\" && _b || Object, typeof (_c = typeof PopoverController !== \"undefined\" && PopoverController) === \"function\" && _c || Object])\n], AboutPage);\n        ";
            var knownContent = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n    if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n    return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n    if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nimport { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, Output, ViewChild, ViewChildren } from '@angular/core';\nimport { IonicPage, NavController, PopoverController } from 'ionic-angular';\nvar AboutPage = (function () {\n    function AboutPage(navCtrl, popoverCtrl) {\n        this.navCtrl = navCtrl;\n        this.popoverCtrl = popoverCtrl;\n        this.conferenceDate = '2047-05-18';\n        this.someVariable = '';\n        this.emitter = new EventEmitter();\n    }\n    AboutPage.prototype.presentPopover = function (event) {\n        var popover = this.popoverCtrl.create('PopoverPage');\n        popover.present({ ev: event });\n    };\n    AboutPage.prototype.someFunction = function (event) {\n    };\n    return AboutPage;\n}());\n" + inputDecorator + "\n" + outputDecorator + "\n" + viewChildDecorator + "\n" + viewChildrenDecorator + "\n" + hostBindingDecorator + "\n" + hostListenerDecorator + "\n" + classDecorators + "\nexport { AboutPage };\nvar _a, _b, _c;\n//# sourceMappingURL=about.js.map\n        ";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'action-sheet', 'action-sheet-component.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeTranspiledDecorators(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(inputDecorator)).toEqual(-1);
            expect(result.indexOf(outputDecorator)).toEqual(-1);
            expect(result.indexOf(viewChildDecorator)).toEqual(-1);
            expect(result.indexOf(viewChildrenDecorator)).toEqual(-1);
            expect(result.indexOf(hostBindingDecorator)).toEqual(-1);
            expect(result.indexOf(hostListenerDecorator)).toEqual(-1);
            expect(result.indexOf(classDecorators)).toEqual(-1);
        });
        it('should not purge any injectable decorators', function () {
            var injectableDecorator = "\nConferenceData = __decorate([\n    Injectable(),\n    __metadata(\"design:paramtypes\", [typeof (_a = typeof Http !== \"undefined\" && Http) === \"function\" && _a || Object, typeof (_b = typeof UserData !== \"undefined\" && UserData) === \"function\" && _b || Object])\n], ConferenceData);\n        ";
            var knownContent = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n    if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n    return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n    if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nimport { Injectable } from '@angular/core';\nimport { Http } from '@angular/http';\nimport { UserData } from './user-data';\nimport { Observable } from 'rxjs/Observable';\nimport 'rxjs/add/operator/map';\nimport 'rxjs/add/observable/of';\nvar ConferenceData = (function () {\n    function ConferenceData(http, user) {\n        this.http = http;\n        this.user = user;\n    }\n    ConferenceData.prototype.load = function () {\n        if (this.data) {\n            return Observable.of(this.data);\n        }\n        else {\n            return this.http.get('assets/data/data.json')\n                .map(this.processData, this);\n        }\n    };\n    ConferenceData.prototype.processData = function (data) {\n        var _this = this;\n        // just some good 'ol JS fun with objects and arrays\n        // build up the data by linking speakers to sessions\n        this.data = data.json();\n        this.data.tracks = [];\n        // loop through each day in the schedule\n        this.data.schedule.forEach(function (day) {\n            // loop through each timeline group in the day\n            day.groups.forEach(function (group) {\n                // loop through each session in the timeline group\n                group.sessions.forEach(function (session) {\n                    session.speakers = [];\n                    if (session.speakerNames) {\n                        session.speakerNames.forEach(function (speakerName) {\n                            var speaker = _this.data.speakers.find(function (s) { return s.name === speakerName; });\n                            if (speaker) {\n                                session.speakers.push(speaker);\n                                speaker.sessions = speaker.sessions || [];\n                                speaker.sessions.push(session);\n                            }\n                        });\n                    }\n                    if (session.tracks) {\n                        session.tracks.forEach(function (track) {\n                            if (_this.data.tracks.indexOf(track) < 0) {\n                                _this.data.tracks.push(track);\n                            }\n                        });\n                    }\n                });\n            });\n        });\n        return this.data;\n    };\n    ConferenceData.prototype.getTimeline = function (dayIndex, queryText, excludeTracks, segment) {\n        var _this = this;\n        if (queryText === void 0) { queryText = ''; }\n        if (excludeTracks === void 0) { excludeTracks = []; }\n        if (segment === void 0) { segment = 'all'; }\n        return this.load().map(function (data) {\n            var day = data.schedule[dayIndex];\n            day.shownSessions = 0;\n            queryText = queryText.toLowerCase().replace(/,|.|-/g, ' ');\n            var queryWords = queryText.split(' ').filter(function (w) { return !!w.trim().length; });\n            day.groups.forEach(function (group) {\n                group.hide = true;\n                group.sessions.forEach(function (session) {\n                    // check if this session should show or not\n                    _this.filterSession(session, queryWords, excludeTracks, segment);\n                    if (!session.hide) {\n                        // if this session is not hidden then this group should show\n                        group.hide = false;\n                        day.shownSessions++;\n                    }\n                });\n            });\n            return day;\n        });\n    };\n    ConferenceData.prototype.filterSession = function (session, queryWords, excludeTracks, segment) {\n        var matchesQueryText = false;\n        if (queryWords.length) {\n            // of any query word is in the session name than it passes the query test\n            queryWords.forEach(function (queryWord) {\n                if (session.name.toLowerCase().indexOf(queryWord) > -1) {\n                    matchesQueryText = true;\n                }\n            });\n        }\n        else {\n            // if there are no query words then this session passes the query test\n            matchesQueryText = true;\n        }\n        // if any of the sessions tracks are not in the\n        // exclude tracks then this session passes the track test\n        var matchesTracks = false;\n        session.tracks.forEach(function (trackName) {\n            if (excludeTracks.indexOf(trackName) === -1) {\n                matchesTracks = true;\n            }\n        });\n        // if the segement is 'favorites', but session is not a user favorite\n        // then this session does not pass the segment test\n        var matchesSegment = false;\n        if (segment === 'favorites') {\n            if (this.user.hasFavorite(session.name)) {\n                matchesSegment = true;\n            }\n        }\n        else {\n            matchesSegment = true;\n        }\n        // all tests must be true if it should not be hidden\n        session.hide = !(matchesQueryText && matchesTracks && matchesSegment);\n    };\n    ConferenceData.prototype.getSpeakers = function () {\n        return this.load().map(function (data) {\n            return data.speakers.sort(function (a, b) {\n                var aName = a.name.split(' ').pop();\n                var bName = b.name.split(' ').pop();\n                return aName.localeCompare(bName);\n            });\n        });\n    };\n    ConferenceData.prototype.getTracks = function () {\n        return this.load().map(function (data) {\n            return data.tracks.sort();\n        });\n    };\n    ConferenceData.prototype.getMap = function () {\n        return this.load().map(function (data) {\n            return data.map;\n        });\n    };\n    return ConferenceData;\n}());\n" + injectableDecorator + "\nexport { ConferenceData };\nvar _a, _b;\n//# sourceMappingURL=conference-data.js.map\n        ";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'action-sheet', 'action-sheet-component.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeTranspiledDecorators(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(injectableDecorator)).toBeGreaterThan(1);
        });
        it('should not remove the third party decorators', function () {
            var selectDecorator = "\n__decorate([\n    select(),\n    __metadata(\"design:type\", Object)\n], DashPage.prototype, \"user$\", void 0);\n";
            var knownContent = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n    if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n    return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n    if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nimport { Component } from '@angular/core';\nimport { select } from '@angular-redux/store';\nvar DashPage = (function () {\n    function DashPage() {\n    }\n    DashPage.prototype.ionViewDidLoad = function () {\n        var _this = this;\n        this.user$.subscribe(function (user) {\n            _this.user = user;\n        });\n    };\n    return DashPage;\n}());\n" + selectDecorator + "\nDashPage = __decorate([\n    Component({\n        selector: 'page-dash',\n        templateUrl: 'dash-page.html'\n    }),\n    __metadata(\"design:paramtypes\", [])\n], DashPage);\nexport { DashPage };\n//# sourceMappingURL=dash-page.js.map\n";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'action-sheet', 'action-sheet-component.js');
            spyOn(helpers, helpers.isSrcOrIonicOrIonicDeps.name).and.returnValue(true);
            magicString = decorators.purgeTranspiledDecorators(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(selectDecorator)).toBeGreaterThan(1);
        });
    });
    describe('addPureAnnotation', function () {
        it('should add the pure annotation to a transpiled class', function () {
            var knownContent = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n    if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n    return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n    if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nimport { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, Output, ViewChild, ViewChildren } from '@angular/core';\nimport { IonicPage, NavController, PopoverController } from 'ionic-angular';\nvar AboutPage = (function () {\n    function AboutPage(navCtrl, popoverCtrl) {\n        this.navCtrl = navCtrl;\n        this.popoverCtrl = popoverCtrl;\n        this.conferenceDate = '2047-05-18';\n        this.someVariable = '';\n        this.emitter = new EventEmitter();\n    }\n    AboutPage.prototype.presentPopover = function (event) {\n        var popover = this.popoverCtrl.create('PopoverPage');\n        popover.present({ ev: event });\n    };\n    AboutPage.prototype.someFunction = function (event) {\n    };\n    return AboutPage;\n}());\nexport { AboutPage };\nvar _a, _b, _c;\n//# sourceMappingURL=about.js.map\n        ";
            var expectedContent = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n    if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n    return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n    if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nimport { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, Output, ViewChild, ViewChildren } from '@angular/core';\nimport { IonicPage, NavController, PopoverController } from 'ionic-angular';\nvar AboutPage = /*#__PURE__*/ (function () {\n    function AboutPage(navCtrl, popoverCtrl) {\n        this.navCtrl = navCtrl;\n        this.popoverCtrl = popoverCtrl;\n        this.conferenceDate = '2047-05-18';\n        this.someVariable = '';\n        this.emitter = new EventEmitter();\n    }\n    AboutPage.prototype.presentPopover = function (event) {\n        var popover = this.popoverCtrl.create('PopoverPage');\n        popover.present({ ev: event });\n    };\n    AboutPage.prototype.someFunction = function (event) {\n    };\n    return AboutPage;\n}());\nexport { AboutPage };\nvar _a, _b, _c;\n//# sourceMappingURL=about.js.map\n        ";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'action-sheet', 'action-sheet-component.js');
            magicString = decorators.addPureAnnotation(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result).toEqual(expectedContent);
        });
        it('should work with a class that extends another class', function () {
            var knownContent = "\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nimport { Directive, ElementRef, Renderer } from '@angular/core';\nimport { Config } from '../../config/config';\nimport { Ion } from '../ion';\n/**\n * @hidden\n */\nvar CardContent = (function (_super) {\n    __extends(CardContent, _super);\n    /**\n     * @param {?} config\n     * @param {?} elementRef\n     * @param {?} renderer\n     */\n    function CardContent(config, elementRef, renderer) {\n        return _super.call(this, config, elementRef, renderer, 'card-content') || this;\n    }\n    return CardContent;\n}(Ion));\nexport { CardContent };\n/**\n * @nocollapse\n */\nCardContent.ctorParameters = function () { return [\n    { type: Config, },\n    { type: ElementRef, },\n    { type: Renderer, },\n]; };\nfunction CardContent_tsickle_Closure_declarations() {\n    /** @type {?} */\n    CardContent.decorators;\n    /**\n     * @nocollapse\n     * @type {?}\n     */\n    CardContent.ctorParameters;\n}\n//# sourceMappingURL=card-content.js.map\n";
            var expectedContent = "\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nimport { Directive, ElementRef, Renderer } from '@angular/core';\nimport { Config } from '../../config/config';\nimport { Ion } from '../ion';\n/**\n * @hidden\n */\nvar CardContent = /*#__PURE__*/ (function (_super) {\n    __extends(CardContent, _super);\n    /**\n     * @param {?} config\n     * @param {?} elementRef\n     * @param {?} renderer\n     */\n    function CardContent(config, elementRef, renderer) {\n        return _super.call(this, config, elementRef, renderer, 'card-content') || this;\n    }\n    return CardContent;\n}(Ion));\nexport { CardContent };\n/**\n * @nocollapse\n */\nCardContent.ctorParameters = function () { return [\n    { type: Config, },\n    { type: ElementRef, },\n    { type: Renderer, },\n]; };\nfunction CardContent_tsickle_Closure_declarations() {\n    /** @type {?} */\n    CardContent.decorators;\n    /**\n     * @nocollapse\n     * @type {?}\n     */\n    CardContent.ctorParameters;\n}\n//# sourceMappingURL=card-content.js.map\n";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'action-sheet', 'action-sheet-component.js');
            magicString = decorators.addPureAnnotation(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result).toEqual(expectedContent);
        });
    });
    describe('purgeStaticCtorFields', function () {
        it('should purge the ctor field', function () {
            var ctorParams = "\nBadge.ctorParameters = function () { return [\n    { type: Config, },\n    { type: ElementRef, },\n    { type: Renderer, },\n]; };\n";
            var knownContent = "\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = Object.setPrototypeOf ||\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nimport { Directive, ElementRef, Renderer } from '@angular/core';\nimport { Config } from '../../config/config';\nimport { Ion } from '../ion';\n\nvar Badge = (function (_super) {\n    __extends(Badge, _super);\n\n    function Badge(config, elementRef, renderer) {\n        return _super.call(this, config, elementRef, renderer, 'badge') || this;\n    }\n    return Badge;\n}(Ion));\nexport { Badge };\nBadge.decorators = [\n    { type: Directive, args: [{\n                selector: 'ion-badge'\n            },] },\n];\n\n" + ctorParams + "\nfunction Badge_tsickle_Closure_declarations() {\n\n    Badge.decorators;\n\n    Badge.ctorParameters;\n}\n//# sourceMappingURL=badge.js.map\n";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'badge', 'badge.js');
            spyOn(helpers, helpers.isIonicOrAngular.name).and.returnValue(true);
            magicString = decorators.purgeStaticCtorFields(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(ctorParams)).toEqual(-1);
        });
        it('should purge an empty ctor field', function () {
            var ctorParams = "\nAvatar.ctorParameters = function () { return []; };\n      ";
            var knownContent = "\n\nvar Avatar = (function () {\n    function Avatar() {\n    }\n    return Avatar;\n}());\nexport { Avatar };\nAvatar.decorators = [\n    { type: Directive, args: [{\n                selector: 'ion-avatar'\n            },] },\n];\n\n" + ctorParams + "\nfunction Avatar_tsickle_Closure_declarations() {\n    Avatar.decorators;\n\n    Avatar.ctorParameters;\n}\n//# sourceMappingURL=avatar.js.map\n      ";
            var magicString = new MagicString(knownContent);
            var filePath = path_1.join(ionicAngular, 'components', 'badge', 'badge.js');
            spyOn(helpers, helpers.isIonicOrAngular.name).and.returnValue(true);
            magicString = decorators.purgeStaticCtorFields(filePath, knownContent, magicString);
            var result = magicString.toString();
            expect(result.indexOf(ctorParams)).toEqual(-1);
        });
    });
});
