text:
Please ensure that you set the `DOWNLOAD_URL` and `DOWNLOAD_TOKEN` environmental variables.  For example:
```console
export DOWNLOAD_URL="mapbox://styles/username/cierw1nhu00bi8bnymdqvihrq"
export DOWNLOAD_TOKEN="pk.ezG4Ijoic25vZG5pcHPlciIsImFiOiIwNTUzNgEzNWIxRzk4ODM0NTUxZWIyMzceZjR7MDI1MiJ9.s9T8QPo0GjAV5OBvRdfnzA"
```

We also set the source MBTiles file to download:
```console
export DOWNLOAD_MBTILES="https://download-location.com/OS_data_z15_0_7.mbtiles"
```

We can then execute the workflow:
```console
./InstallDocker.sh
./0_data_prepare/run.sh
./1_repo_clone/run.sh
./2_build_sdk_containers/run.sh
./3_download_from_endpoint/run.sh
```

Note: the example download url points to a Mapbox endpoint.  Mapbox licensing only permits downloads for use by the device initiating the download - you should therefore ensure that your actions are permitted according to the Mapbox TOS.  Typically, one would use their own download location to obtain their own content (not, say, Streets-V9 etc. - which is Mapbox data!).


text:
/******************************************************************

 iLBC Speech Coder ANSI-C Source Code

 WebRtcIlbcfix_GainQuant.h

******************************************************************/

#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_GAIN_QUANT_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_GAIN_QUANT_H_

#include "defines.h"

/*----------------------------------------------------------------*
 *  quantizer for the gain in the gain-shape coding of residual
 *---------------------------------------------------------------*/

WebRtc_Word16 WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
    WebRtc_Word16 gain, /* (i) gain value Q14 */
    WebRtc_Word16 maxIn, /* (i) maximum of gain value Q14 */
    WebRtc_Word16 stage, /* (i) The stage of the search */
    WebRtc_Word16 *index /* (o) quantization index */
                                       );

#endif

redpajama_set_name: RedPajamaGithub


text:
import {DOWN_ARROW, SPACE, ENTER, UP_ARROW, HOME, END, A, D, TAB} from '@angular/cdk/keycodes';
import {
  createKeyboardEvent,
  dispatchFakeEvent,
  dispatchEvent,
  dispatchKeyboardEvent,
  dispatchMouseEvent,
} from '@angular/cdk/testing/private';
import {
  Component,
  DebugElement,
  ChangeDetectionStrategy,
  QueryList,
  ViewChildren,
} from '@angular/core';
import {
  waitForAsync,
  ComponentFixture,
  fakeAsync,
  TestBed,
  tick,
  flush,
  inject,
} from '@angular/core/testing';
import {MatRipple, defaultRippleAnimationConfig, ThemePalette} from '@angular/material/core';
import {By} from '@angular/platform-browser';
import {
  MatListModule,
  MatListOption,
  MatSelectionList,
  MatSelectionListChange
} from './index';
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
import {FocusMonitor} from '@angular/cdk/a11y';

describe('MatSelectionList without forms', () => {
  describe('with list option', () => {
    let fixture: ComponentFixture<SelectionListWithListOptions>;
    let listOptions: DebugElement[];
    let selectionList: DebugElement;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [
          SelectionListWithListOptions,
          SelectionListWithCheckboxPositionAfter,
          SelectionListWithListDisabled,
          SelectionListWithOnlyOneOption,
          SelectionListWithIndirectChildOptions,
          SelectionListWithSelectedOptionAndValue,
          SelectionListWithIndirectDescendantLines,
        ],
      });

      TestBed.compileComponents();
    }));

    beforeEach(waitForAsync(() => {
      fixture = TestBed.createComponent(SelectionListWithListOptions);
      fixture.detectChanges();

      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption));
      selectionList = fixture.debugElement.query(By.directive(MatSelectionList))!;
    }));

    it('should be able to set a value on a list option', () => {
      const optionValues = ['inbox', 'starred', 'sent-mail', 'archive', 'drafts'];

      optionValues.forEach((optionValue, index) => {
        expect(listOptions[index].componentInstance.value).toBe(optionValue);
      });
    });

    it('should not emit a selectionChange event if an option changed programmatically', () => {
      spyOn(fixture.componentInstance, 'onSelectionChange');

      expect(fixture.componentInstance.onSelectionChange).toHaveBeenCalledTimes(0);

      listOptions[2].componentInstance.toggle();
      fixture.detectChanges();

      expect(fixture.componentInstance.onSelectionChange).toHaveBeenCalledTimes(0);
    });

    it('should emit a selectionChange event if an option got clicked', () => {
      spyOn(fixture.componentInstance, 'onSelectionChange');

      expect(fixture.componentInstance.onSelectionChange).toHaveBeenCalledTimes(0);

      dispatchFakeEvent(listOptions[2].nativeElement, 'click');
      fixture.detectChanges();

      expect(fixture.componentInstance.onSelectionChange).toHaveBeenCalledTimes(1);
    });

    it('should be able to dispatch one selected item', () => {
      let testListItem = listOptions[2].injector.get<MatListOption>(MatListOption);
      let selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);
      expect(listOptions[2].nativeElement.getAttribute('aria-selected')).toBe('false');

      testListItem.toggle();
      fixture.detectChanges();

      expect(listOptions[2].nativeElement.getAttribute('aria-selected')).toBe('true');
      expect(listOptions[2].nativeElement.getAttribute('aria-disabled')).toBe('false');
      expect(selectList.selected.length).toBe(1);
    });

    it('should be able to dispatch multiple selected items', () => {
      let testListItem = listOptions[2].injector.get<MatListOption>(MatListOption);
      let testListItem2 = listOptions[1].injector.get<MatListOption>(MatListOption);
      let selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);
      expect(listOptions[2].nativeElement.getAttribute('aria-selected')).toBe('false');
      expect(listOptions[1].nativeElement.getAttribute('aria-selected')).toBe('false');

      testListItem.toggle();
      fixture.detectChanges();

      testListItem2.toggle();
      fixture.detectChanges();

      expect(selectList.selected.length).toBe(2);
      expect(listOptions[2].nativeElement.getAttribute('aria-selected')).toBe('true');
      expect(listOptions[1].nativeElement.getAttribute('aria-selected')).toBe('true');
      expect(listOptions[1].nativeElement.getAttribute('aria-disabled')).toBe('false');
      expect(listOptions[2].nativeElement.getAttribute('aria-disabled')).toBe('false');
    });

    it('should be able to specify a color for list options', () => {
      const optionNativeElements = listOptions.map(option => option.nativeElement);

      expect(optionNativeElements.every(option => !option.classList.contains('mat-primary')))
        .toBe(true);
      expect(optionNativeElements.every(option => !option.classList.contains('mat-warn')))
        .toBe(true);

      // All options will be set to the "warn" color.
      fixture.componentInstance.selectionListColor = 'warn';
      fixture.detectChanges();

      expect(optionNativeElements.every(option => !option.classList.contains('mat-primary')))
        .toBe(true);
      expect(optionNativeElements.every(option => option.classList.contains('mat-warn')))
        .toBe(true);

      // Color will be set explicitly for an option and should take precedence.
      fixture.componentInstance.firstOptionColor = 'primary';
      fixture.detectChanges();

      expect(optionNativeElements[0].classList).toContain('mat-primary');
      expect(optionNativeElements[0].classList).not.toContain('mat-warn');
      expect(optionNativeElements.slice(1).every(option => option.classList.contains('mat-warn')))
        .toBe(true);
    });

    it('should explicitly set the `accent` color', () => {
      const classList = listOptions[0].nativeElement.classList;

      fixture.componentInstance.firstOptionColor = 'primary';
      fixture.detectChanges();

      expect(classList).toContain('mat-primary');
      expect(classList).not.toContain('mat-accent');
      expect(classList).not.toContain('mat-warn');

      fixture.componentInstance.firstOptionColor = 'accent';
      fixture.detectChanges();

      expect(classList).not.toContain('mat-primary');
      expect(classList).toContain('mat-accent');
      expect(classList).not.toContain('mat-warn');
    });

    it('should be able to deselect an option', () => {
      let testListItem = listOptions[2].injector.get<MatListOption>(MatListOption);
      let selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);

      testListItem.toggle();
      fixture.detectChanges();

      expect(selectList.selected.length).toBe(1);

      testListItem.toggle();
      fixture.detectChanges();

      expect(selectList.selected.length).toBe(0);
    });

    it('should not add the mat-list-single-selected-option class (in multiple mode)', () => {
      let testListItem = listOptions[2].injector.get<MatListOption>(MatListOption);

      testListItem._handleClick();
      fixture.detectChanges();

      expect(listOptions[2].nativeElement.classList.contains('mat-list-single-selected-option'))
          .toBe(false);
    });

    it('should not allow selection of disabled items', () => {
      let testListItem = listOptions[0].injector.get<MatListOption>(MatListOption);
      let selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);
      expect(listOptions[0].nativeElement.getAttribute('aria-disabled')).toBe('true');

      testListItem._handleClick();
      fixture.detectChanges();

      expect(selectList.selected.length).toBe(0);
    });

    it('should be able to un-disable disabled items', () => {
      let testListItem = listOptions[0].injector.get<MatListOption>(MatListOption);

      expect(listOptions[0].nativeElement.getAttribute('aria-disabled')).toBe('true');

      testListItem.disabled = false;
      fixture.detectChanges();

      expect(listOptions[0].nativeElement.getAttribute('aria-disabled')).toBe('false');
    });

    it('should be able to use keyboard select with SPACE', () => {
      const testListItem = listOptions[1].nativeElement as HTMLElement;
      const SPACE_EVENT = createKeyboardEvent('keydown', SPACE);
      const selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;
      expect(selectList.selected.length).toBe(0);

      dispatchFakeEvent(testListItem, 'focus');
      selectionList.componentInstance._keydown(SPACE_EVENT);

      fixture.detectChanges();

      expect(selectList.selected.length).toBe(1);
      expect(SPACE_EVENT.defaultPrevented).toBe(true);
    });

    it('should be able to select an item using ENTER', () => {
      const testListItem = listOptions[1].nativeElement as HTMLElement;
      const ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
      const selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;
      expect(selectList.selected.length).toBe(0);

      dispatchFakeEvent(testListItem, 'focus');
      selectionList.componentInstance._keydown(ENTER_EVENT);

      fixture.detectChanges();

      expect(selectList.selected.length).toBe(1);
      expect(ENTER_EVENT.defaultPrevented).toBe(true);
    });

    it('should not be able to toggle an item when pressing a modifier key', () => {
      const testListItem = listOptions[1].nativeElement as HTMLElement;
      const selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);

      [ENTER, SPACE].forEach(key => {
        const event = createKeyboardEvent('keydown', key, undefined, {control: true});

        dispatchFakeEvent(testListItem, 'focus');
        selectionList.componentInstance._keydown(event);
        fixture.detectChanges();
        expect(event.defaultPrevented).toBe(false);
      });

      expect(selectList.selected.length).toBe(0);
    });

    it('should not be able to toggle a disabled option using SPACE', () => {
      const testListItem = listOptions[1].nativeElement as HTMLElement;
      const selectionModel = selectionList.componentInstance.selectedOptions;

      expect(selectionModel.selected.length).toBe(0);

      listOptions[1].componentInstance.disabled = true;

      dispatchFakeEvent(testListItem, 'focus');
      selectionList.componentInstance._keydown(createKeyboardEvent('keydown', SPACE));
      fixture.detectChanges();

      expect(selectionModel.selected.length).toBe(0);
    });

    it('should focus the first option when the list takes focus for the first time', () => {
      spyOn(listOptions[0].componentInstance, 'focus').and.callThrough();

      const manager = selectionList.componentInstance._keyManager;
      expect(manager.activeItemIndex).toBe(-1);

      dispatchFakeEvent(selectionList.nativeElement, 'focus');
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(0);
      expect(listOptions[0].componentInstance.focus).toHaveBeenCalled();
    });

    it('should not move focus to the first item if focus originated from a mouse interaction',
      fakeAsync(inject([FocusMonitor], (focusMonitor: FocusMonitor) => {
        spyOn(listOptions[0].componentInstance, 'focus').and.callThrough();

        const manager = selectionList.componentInstance._keyManager;
        expect(manager.activeItemIndex).toBe(-1);

        focusMonitor.focusVia(selectionList.nativeElement, 'mouse');
        fixture.detectChanges();
        flush();

        expect(manager.activeItemIndex).toBe(-1);
        expect(listOptions[0].componentInstance.focus).not.toHaveBeenCalled();
      })));

    it('should focus the previously focused option when the list takes focus a second time', () => {
      spyOn(listOptions[1].componentInstance, 'focus').and.callThrough();

      const manager = selectionList.componentInstance._keyManager;
      expect(manager.activeItemIndex).toBe(-1);

      // Focus and blur the option to move the active item index. This option is now the previously
      // focused option.
      listOptions[1].componentInstance._handleFocus();
      listOptions[1].componentInstance._handleBlur();

      dispatchFakeEvent(selectionList.nativeElement, 'focus');
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(1);
      expect(listOptions[1].componentInstance.focus).toHaveBeenCalled();
    });

    it('should allow focus to escape when tabbing away', fakeAsync(() => {
      selectionList.componentInstance._keyManager.onKeydown(createKeyboardEvent('keydown', TAB));

      expect(selectionList.componentInstance._tabIndex)
          .toBe(-1, 'Expected tabIndex to be set to -1 temporarily.');

      tick();

      expect(selectionList.componentInstance._tabIndex)
          .toBe(0, 'Expected tabIndex to be reset back to 0');
    }));

    it('should restore focus if active option is destroyed', () => {
      const manager = selectionList.componentInstance._keyManager;

      spyOn(listOptions[3].componentInstance, 'focus').and.callThrough();
      listOptions[4].componentInstance._handleFocus();

      expect(manager.activeItemIndex).toBe(4);

      fixture.componentInstance.showLastOption = false;
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(3);
      expect(listOptions[3].componentInstance.focus).toHaveBeenCalled();
    });

    it('should not attempt to focus the next option when the destroyed option was not focused',
      () => {
        const manager = selectionList.componentInstance._keyManager;

        // Focus and blur the option to move the active item index.
        listOptions[4].componentInstance._handleFocus();
        listOptions[4].componentInstance._handleBlur();

        spyOn(listOptions[3].componentInstance, 'focus').and.callThrough();

        expect(manager.activeItemIndex).toBe(4);

        fixture.componentInstance.showLastOption = false;
        fixture.detectChanges();

        expect(manager.activeItemIndex).toBe(3);
        expect(listOptions[3].componentInstance.focus).not.toHaveBeenCalled();
      });

    it('should focus previous item when press UP ARROW', () => {
      let UP_EVENT = createKeyboardEvent('keydown', UP_ARROW);
      let manager = selectionList.componentInstance._keyManager;

      dispatchFakeEvent(listOptions[2].nativeElement, 'focus');
      expect(manager.activeItemIndex).toEqual(2);

      selectionList.componentInstance._keydown(UP_EVENT);

      fixture.detectChanges();

      expect(manager.activeItemIndex).toEqual(1);
    });

    it('should focus and toggle the next item when pressing SHIFT + UP_ARROW', () => {
      const manager = selectionList.componentInstance._keyManager;
      const upKeyEvent = createKeyboardEvent('keydown', UP_ARROW, undefined, {shift: true});

      dispatchFakeEvent(listOptions[3].nativeElement, 'focus');
      expect(manager.activeItemIndex).toBe(3);

      expect(listOptions[1].componentInstance.selected).toBe(false);
      expect(listOptions[2].componentInstance.selected).toBe(false);

      selectionList.componentInstance._keydown(upKeyEvent);
      fixture.detectChanges();

      expect(listOptions[1].componentInstance.selected).toBe(false);
      expect(listOptions[2].componentInstance.selected).toBe(true);

      selectionList.componentInstance._keydown(upKeyEvent);
      fixture.detectChanges();

      expect(listOptions[1].componentInstance.selected).toBe(true);
      expect(listOptions[2].componentInstance.selected).toBe(true);
    });

    it('should focus next item when press DOWN ARROW', () => {
      const manager = selectionList.componentInstance._keyManager;

      dispatchFakeEvent(listOptions[2].nativeElement, 'focus');
      expect(manager.activeItemIndex).toEqual(2);

      selectionList.componentInstance._keydown(createKeyboardEvent('keydown', DOWN_ARROW));
      fixture.detectChanges();

      expect(manager.activeItemIndex).toEqual(3);
    });

    it('should focus and toggle the next item when pressing SHIFT + DOWN_ARROW', () => {
      const manager = selectionList.componentInstance._keyManager;
      const downKeyEvent = createKeyboardEvent('keydown', DOWN_ARROW, undefined, {shift: true});

      dispatchFakeEvent(listOptions[0].nativeElement, 'focus');
      expect(manager.activeItemIndex).toBe(0);

      expect(listOptions[1].componentInstance.selected).toBe(false);
      expect(listOptions[2].componentInstance.selected).toBe(false);

      selectionList.componentInstance._keydown(downKeyEvent);
      fixture.detectChanges();

      expect(listOptions[1].componentInstance.selected).toBe(true);
      expect(listOptions[2].componentInstance.selected).toBe(false);

      selectionList.componentInstance._keydown(downKeyEvent);
      fixture.detectChanges();

      expect(listOptions[1].componentInstance.selected).toBe(true);
      expect(listOptions[2].componentInstance.selected).toBe(true);
    });

    it('should be able to focus the first item when pressing HOME', () => {
      const manager = selectionList.componentInstance._keyManager;
      expect(manager.activeItemIndex).toBe(-1);

      const event = dispatchKeyboardEvent(selectionList.nativeElement, 'keydown', HOME);
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(0);
      expect(event.defaultPrevented).toBe(true);
    });

    it('should not change focus when pressing HOME with a modifier key', () => {
      const manager = selectionList.componentInstance._keyManager;
      expect(manager.activeItemIndex).toBe(-1);

      const event = createKeyboardEvent('keydown', HOME, undefined, {alt: true});

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(-1);
      expect(event.defaultPrevented).toBe(false);
    });

    it('should focus the last item when pressing END', () => {
      const manager = selectionList.componentInstance._keyManager;
      expect(manager.activeItemIndex).toBe(-1);

      const event = dispatchKeyboardEvent(selectionList.nativeElement, 'keydown', END);
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(4);
      expect(event.defaultPrevented).toBe(true);
    });

    it('should not change focus when pressing END with a modifier key', () => {
      const manager = selectionList.componentInstance._keyManager;
      expect(manager.activeItemIndex).toBe(-1);

      const event = createKeyboardEvent('keydown', END, undefined, {alt: true});

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(-1);
      expect(event.defaultPrevented).toBe(false);
    });

    it('should select all items using ctrl + a', () => {
      listOptions.forEach(option => option.componentInstance.disabled = false);
      const event = createKeyboardEvent('keydown', A, undefined, {control: true});

      expect(listOptions.some(option => option.componentInstance.selected)).toBe(false);

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(listOptions.every(option => option.componentInstance.selected)).toBe(true);
    });

    it('should not select disabled items when pressing ctrl + a', () => {
      const event = createKeyboardEvent('keydown', A, undefined, {control: true});

      listOptions.slice(0, 2).forEach(option => option.componentInstance.disabled = true);
      fixture.detectChanges();

      expect(listOptions.map(option => option.componentInstance.selected))
          .toEqual([false, false, false, false, false]);

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(listOptions.map(option => option.componentInstance.selected))
          .toEqual([false, false, true, true, true]);
    });

    it('should select all items using ctrl + a if some items are selected', () => {
      const event = createKeyboardEvent('keydown', A, undefined, {control: true});

      listOptions.slice(0, 2).forEach(option => option.componentInstance.selected = true);
      fixture.detectChanges();

      expect(listOptions.some(option => option.componentInstance.selected)).toBe(true);

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(listOptions.every(option => option.componentInstance.selected)).toBe(true);
    });

    it('should deselect all with ctrl + a if all options are selected', () => {
      const event = createKeyboardEvent('keydown', A, undefined, {control: true});

      listOptions.forEach(option => option.componentInstance.selected = true);
      fixture.detectChanges();

      expect(listOptions.every(option => option.componentInstance.selected)).toBe(true);

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(listOptions.every(option => option.componentInstance.selected)).toBe(false);
    });

    it('should dispatch the selectionChange event when selecting via ctrl + a', () => {
      const spy = spyOn(fixture.componentInstance, 'onSelectionChange');
      listOptions.forEach(option => option.componentInstance.disabled = false);
      const event = createKeyboardEvent('keydown', A, undefined, {control: true});

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(spy).toHaveBeenCalledTimes(1);
      expect(spy).toHaveBeenCalledWith(jasmine.objectContaining({
        options: listOptions.map(option => option.componentInstance)
      }));
    });

    it('should be able to jump focus down to an item by typing', fakeAsync(() => {
      const listEl = selectionList.nativeElement;
      const manager = selectionList.componentInstance._keyManager;

      expect(manager.activeItemIndex).toBe(-1);

      dispatchEvent(listEl, createKeyboardEvent('keydown', 83, 's'));
      fixture.detectChanges();
      tick(200);

      expect(manager.activeItemIndex).toBe(1);

      dispatchEvent(listEl, createKeyboardEvent('keydown', 68, 'd'));
      fixture.detectChanges();
      tick(200);

      expect(manager.activeItemIndex).toBe(4);
    }));

    it('should be able to skip to an item by typing', fakeAsync(() => {
      const manager = selectionList.componentInstance._keyManager;

      expect(manager.activeItemIndex).not.toBe(4);

      const event = createKeyboardEvent('keydown', D, 'd');
      selectionList.componentInstance._keydown(event);
      fixture.detectChanges();
      tick(200);

      expect(manager.activeItemIndex).toBe(4);
    }));

    // Test for "A" specifically, because it's a special case that can be used to select all values.
    it('should be able to skip to an item by typing the letter "A"', fakeAsync(() => {
      const manager = selectionList.componentInstance._keyManager;

      expect(manager.activeItemIndex).not.toBe(3);

      const event = createKeyboardEvent('keydown', A, 'a');
      selectionList.componentInstance._keydown(event);
      fixture.detectChanges();
      tick(200);

      expect(manager.activeItemIndex).toBe(3);
    }));

    it('should not select items while using the typeahead', fakeAsync(() => {
      const manager = selectionList.componentInstance._keyManager;
      const testListItem = listOptions[1].nativeElement as HTMLElement;
      const model =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      dispatchFakeEvent(testListItem, 'focus');
      fixture.detectChanges();

      expect(manager.activeItemIndex).toBe(1);
      expect(model.isEmpty()).toBe(true);

      selectionList.componentInstance._keydown(createKeyboardEvent('keydown', D, 'd'));
      fixture.detectChanges();
      tick(100); // Tick only half the typeahead timeout.

      selectionList.componentInstance._keydown(createKeyboardEvent('keydown', SPACE));
      fixture.detectChanges();
      tick(100); // Tick the rest of the timeout.

      expect(manager.activeItemIndex).toBe(4);
      expect(model.isEmpty()).toBe(true);
    }));

    it('should be able to select all options', () => {
      const list: MatSelectionList = selectionList.componentInstance;

      expect(list.options.toArray().every(option => option.selected)).toBe(false);

      const result = list.selectAll();
      fixture.detectChanges();

      expect(list.options.toArray().every(option => option.selected)).toBe(true);
      expect(result).toEqual(list.options.toArray());
    });

    it('should be able to select all options, even if they are disabled', () => {
      const list: MatSelectionList = selectionList.componentInstance;

      list.options.forEach(option => option.disabled = true);
      fixture.detectChanges();

      expect(list.options.toArray().every(option => option.selected)).toBe(false);

      list.selectAll();
      fixture.detectChanges();

      expect(list.options.toArray().every(option => option.selected)).toBe(true);
    });

    it('should be able to deselect all options', () => {
      const list: MatSelectionList = selectionList.componentInstance;

      list.options.forEach(option => option.toggle());
      expect(list.options.toArray().every(option => option.selected)).toBe(true);

      const result = list.deselectAll();
      fixture.detectChanges();

      expect(list.options.toArray().every(option => option.selected)).toBe(false);
      expect(result).toEqual(list.options.toArray());
    });

    it('should be able to deselect all options, even if they are disabled', () => {
      const list: MatSelectionList = selectionList.componentInstance;

      list.options.forEach(option => option.toggle());
      expect(list.options.toArray().every(option => option.selected)).toBe(true);

      list.options.forEach(option => option.disabled = true);
      fixture.detectChanges();

      list.deselectAll();
      fixture.detectChanges();

      expect(list.options.toArray().every(option => option.selected)).toBe(false);
    });

    it('should update the list value when an item is selected programmatically', () => {
      const list: MatSelectionList = selectionList.componentInstance;

      expect(list.selectedOptions.isEmpty()).toBe(true);

      listOptions[0].componentInstance.selected = true;
      listOptions[2].componentInstance.selected = true;
      fixture.detectChanges();

      expect(list.selectedOptions.isEmpty()).toBe(false);
      expect(list.selectedOptions.isSelected(listOptions[0].componentInstance)).toBe(true);
      expect(list.selectedOptions.isSelected(listOptions[2].componentInstance)).toBe(true);
    });

    it('should update the item selected state when it is selected via the model', () => {
      const list: MatSelectionList = selectionList.componentInstance;
      const item: MatListOption = listOptions[0].componentInstance;

      expect(item.selected).toBe(false);

      list.selectedOptions.select(item);
      fixture.detectChanges();

      expect(item.selected).toBe(true);
    });

    it('should set aria-multiselectable to true on the selection list element', () => {
      expect(selectionList.nativeElement.getAttribute('aria-multiselectable')).toBe('true');
    });

    it('should be able to reach list options that are indirect descendants', () => {
      const descendatsFixture = TestBed.createComponent(SelectionListWithIndirectChildOptions);
      descendatsFixture.detectChanges();
      listOptions = descendatsFixture.debugElement.queryAll(By.directive(MatListOption));
      selectionList = descendatsFixture.debugElement.query(By.directive(MatSelectionList))!;
      const list: MatSelectionList = selectionList.componentInstance;

      expect(list.options.toArray().every(option => option.selected)).toBe(false);

      list.selectAll();
      descendatsFixture.detectChanges();

      expect(list.options.toArray().every(option => option.selected)).toBe(true);
    });

    it('should disable list item ripples when the ripples on the list have been disabled',
      fakeAsync(() => {
        const rippleTarget = fixture.nativeElement
            .querySelector('.mat-list-option:not(.mat-list-item-disabled) .mat-list-item-content');
        const {enterDuration, exitDuration} = defaultRippleAnimationConfig;

        dispatchMouseEvent(rippleTarget, 'mousedown');
        dispatchMouseEvent(rippleTarget, 'mouseup');

        expect(rippleTarget.querySelectorAll('.mat-ripple-element').length)
            .toBe(1, 'Expected ripples to be enabled by default.');

        // Wait for the ripples to go away.
        tick(enterDuration + exitDuration);
        expect(rippleTarget.querySelectorAll('.mat-ripple-element').length)
            .toBe(0, 'Expected ripples to go away.');

        fixture.componentInstance.listRippleDisabled = true;
        fixture.detectChanges();

        dispatchMouseEvent(rippleTarget, 'mousedown');
        dispatchMouseEvent(rippleTarget, 'mouseup');
        flush();

        expect(rippleTarget.querySelectorAll('.mat-ripple-element').length)
            .toBe(0, 'Expected no ripples after list ripples are disabled.');
      }));

    it('can bind both selected and value at the same time', () => {
      const componentFixture = TestBed.createComponent(SelectionListWithSelectedOptionAndValue);
      componentFixture.detectChanges();
      const listItemEl = componentFixture.debugElement.query(By.directive(MatListOption))!;
      expect(listItemEl.componentInstance.selected).toBe(true);
      expect(listItemEl.componentInstance.value).toBe(componentFixture.componentInstance.itemValue);
    });

    it('should pick up indirect descendant lines', () => {
      const componentFixture = TestBed.createComponent(SelectionListWithIndirectDescendantLines);
      componentFixture.detectChanges();

      const option = componentFixture.nativeElement.querySelector('mat-list-option');
      expect(option.classList).toContain('mat-2-line');
    });

    it('should have a focus indicator', () => {
      const optionNativeElements = listOptions.map(option => option.nativeElement);

      expect(optionNativeElements
          .every(element => element.classList.contains('mat-focus-indicator'))).toBe(true);
      });

  });

  describe('with list option selected', () => {
    let fixture: ComponentFixture<SelectionListWithSelectedOption>;
    let listItemEl: DebugElement;
    let selectionList: DebugElement;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [SelectionListWithSelectedOption],
      });

      TestBed.compileComponents();
    }));

    beforeEach(waitForAsync(() => {
      fixture = TestBed.createComponent(SelectionListWithSelectedOption);
      listItemEl = fixture.debugElement.query(By.directive(MatListOption))!;
      selectionList = fixture.debugElement.query(By.directive(MatSelectionList))!;
      fixture.detectChanges();
    }));

    it('should set its initial selected state in the selectedOptions', () => {
      let optionEl = listItemEl.injector.get<MatListOption>(MatListOption);
      let selectedOptions = selectionList.componentInstance.selectedOptions;
      expect(selectedOptions.isSelected(optionEl)).toBeTruthy();
    });
  });

  describe('with changing option value', () => {
    let fixture: ComponentFixture<SelectionListWithChangingOptionValue>;
    let selectionList: MatSelectionList;
    let listOption: MatListOption;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [SelectionListWithChangingOptionValue],
      });

      TestBed.compileComponents();
    }));

    beforeEach(() => {
      fixture = TestBed.createComponent(SelectionListWithChangingOptionValue);
      fixture.detectChanges();

      selectionList = fixture.debugElement.query(By.directive(MatSelectionList))!.componentInstance;
      listOption = fixture.debugElement.query(By.directive(MatListOption))!.componentInstance;
    });

    it('should use `compareWith` function when updating option selection state', () => {
      expect(selectionList.selectedOptions.isSelected(listOption)).toBeTrue();
      fixture.componentInstance.value = {id: 1};
      fixture.detectChanges();
      expect(selectionList.selectedOptions.isSelected(listOption)).toBeTrue();
      fixture.componentInstance.value = {id: 2};
      fixture.detectChanges();
      expect(selectionList.selectedOptions.isSelected(listOption)).toBeFalse();
    });
  });

  describe('with option disabled', () => {
    let fixture: ComponentFixture<SelectionListWithDisabledOption>;
    let listOptionEl: HTMLElement;
    let listOption: MatListOption;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [SelectionListWithDisabledOption]
      });

      TestBed.compileComponents();
    }));

    beforeEach(waitForAsync(() => {
      fixture = TestBed.createComponent(SelectionListWithDisabledOption);

      const listOptionDebug = fixture.debugElement.query(By.directive(MatListOption))!;

      listOption = listOptionDebug.componentInstance;
      listOptionEl = listOptionDebug.nativeElement;

      fixture.detectChanges();
    }));

    it('should disable ripples for disabled option', () => {
      expect(listOption._isRippleDisabled())
        .toBe(false, 'Expected ripples to be enabled by default');

      fixture.componentInstance.disableItem = true;
      fixture.detectChanges();

      expect(listOption._isRippleDisabled())
        .toBe(true, 'Expected ripples to be disabled if option is disabled');
    });

    it('should apply the "mat-list-item-disabled" class properly', () => {
      expect(listOptionEl.classList).not.toContain('mat-list-item-disabled');

      fixture.componentInstance.disableItem = true;
      fixture.detectChanges();

      expect(listOptionEl.classList).toContain('mat-list-item-disabled');
    });
  });

  describe('with list disabled', () => {
    let fixture: ComponentFixture<SelectionListWithListDisabled>;
    let listOption: DebugElement[];
    let selectionList: DebugElement;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [
          SelectionListWithListOptions,
          SelectionListWithCheckboxPositionAfter,
          SelectionListWithListDisabled,
          SelectionListWithOnlyOneOption
        ],
      });

      TestBed.compileComponents();
    }));

    beforeEach(waitForAsync(() => {
      fixture = TestBed.createComponent(SelectionListWithListDisabled);
      listOption = fixture.debugElement.queryAll(By.directive(MatListOption));
      selectionList = fixture.debugElement.query(By.directive(MatSelectionList))!;
      fixture.detectChanges();
    }));

    it('should not allow selection on disabled selection-list', () => {
      let testListItem = listOption[2].injector.get<MatListOption>(MatListOption);
      let selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);

      testListItem._handleClick();
      fixture.detectChanges();

      expect(selectList.selected.length).toBe(0);
    });

    it('should update state of options if list state has changed', () => {
      // To verify that the template of the list options has been re-rendered after the disabled
      // property of the selection list has been updated, the ripple directive can be used.
      // Inspecting the host classes of the options doesn't work because those update as part
      // of the parent template (of the selection-list).
      const listOptionRipple = listOption[2].query(By.directive(MatRipple))!
          .injector.get<MatRipple>(MatRipple);

      expect(listOptionRipple.disabled)
        .toBe(true, 'Expected ripples of list option to be disabled');

      fixture.componentInstance.disabled = false;
      fixture.detectChanges();

      expect(listOptionRipple.disabled)
        .toBe(false, 'Expected ripples of list option to be enabled');
    });
  });

  describe('with checkbox position after', () => {
    let fixture: ComponentFixture<SelectionListWithCheckboxPositionAfter>;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [
          SelectionListWithListOptions,
          SelectionListWithCheckboxPositionAfter,
          SelectionListWithListDisabled,
          SelectionListWithOnlyOneOption
        ],
      });

      TestBed.compileComponents();
    }));

    beforeEach(waitForAsync(() => {
      fixture = TestBed.createComponent(SelectionListWithCheckboxPositionAfter);
      fixture.detectChanges();
    }));

    it('should be able to customize checkbox position', () => {
      let listItemContent = fixture.debugElement.query(By.css('.mat-list-item-content'))!;
      expect(listItemContent.nativeElement.classList).toContain('mat-list-item-content-reverse');
    });
  });

  describe('with list item elements', () => {
    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [
          SelectionListWithAvatar,
          SelectionListWithIcon,
        ],
      }).compileComponents();
    }));

    it('should add a class to reflect that it has an avatar', () => {
      const fixture = TestBed.createComponent(SelectionListWithIcon);
      fixture.detectChanges();

      const listOption = fixture.nativeElement.querySelector('.mat-list-option');
      expect(listOption.classList).toContain('mat-list-item-with-avatar');
    });

    it('should add a class to reflect that it has an icon', () => {
      const fixture = TestBed.createComponent(SelectionListWithIcon);
      fixture.detectChanges();

      const listOption = fixture.nativeElement.querySelector('.mat-list-option');
      expect(listOption.classList).toContain('mat-list-item-with-avatar');
    });
  });

  describe('with single selection', () => {
    let fixture: ComponentFixture<SelectionListWithListOptions>;
    let listOptions: DebugElement[];
    let selectionList: DebugElement;

    beforeEach(waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatListModule],
        declarations: [
          SelectionListWithListOptions,
        ],
      }).compileComponents();

      fixture = TestBed.createComponent(SelectionListWithListOptions);
      fixture.componentInstance.multiple = false;
      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption));
      selectionList = fixture.debugElement.query(By.directive(MatSelectionList))!;
      fixture.detectChanges();
    }));

    it('should select one option at a time', () => {
      const testListItem1 = listOptions[1].injector.get<MatListOption>(MatListOption);
      const testListItem2 = listOptions[2].injector.get<MatListOption>(MatListOption);
      const selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);

      dispatchFakeEvent(testListItem1._getHostElement(), 'click');
      fixture.detectChanges();

      expect(selectList.selected).toEqual([testListItem1]);
      expect(listOptions[1].nativeElement.classList.contains('mat-list-single-selected-option'))
          .toBe(true);

      dispatchFakeEvent(testListItem2._getHostElement(), 'click');
      fixture.detectChanges();

      expect(selectList.selected).toEqual([testListItem2]);
      expect(listOptions[1].nativeElement.classList.contains('mat-list-single-selected-option'))
          .toBe(false);
      expect(listOptions[2].nativeElement.classList.contains('mat-list-single-selected-option'))
          .toBe(true);
    });

    it('should not show check boxes', () => {
      expect(fixture.nativeElement.querySelector('mat-pseudo-checkbox')).toBeFalsy();
    });

    it('should not deselect the target option on click', () => {
      const testListItem1 = listOptions[1].injector.get<MatListOption>(MatListOption);
      const selectList =
          selectionList.injector.get<MatSelectionList>(MatSelectionList).selectedOptions;

      expect(selectList.selected.length).toBe(0);

      dispatchFakeEvent(testListItem1._getHostElement(), 'click');
      fixture.detectChanges();

      expect(selectList.selected).toEqual([testListItem1]);

      dispatchFakeEvent(testListItem1._getHostElement(), 'click');
      fixture.detectChanges();

      expect(selectList.selected).toEqual([testListItem1]);
    });

    it('throws an exception when toggling single/multiple mode after bootstrap', () => {
      fixture.componentInstance.multiple = true;
      expect(() => fixture.detectChanges()).toThrow(new Error(
          'Cannot change `multiple` mode of mat-selection-list after initialization.'));
    });

    it('should do nothing when pressing ctrl + a', () => {
      const event = createKeyboardEvent('keydown', A, undefined, {control: true});

      expect(listOptions.every(option => !option.componentInstance.selected)).toBe(true);

      dispatchEvent(selectionList.nativeElement, event);
      fixture.detectChanges();

      expect(listOptions.every(option => !option.componentInstance.selected)).toBe(true);
    });

    it('should focus, but not toggle, the next item when pressing SHIFT + UP_ARROW in single ' +
      'selection mode', () => {
        const manager = selectionList.componentInstance._keyManager;
        const upKeyEvent = createKeyboardEvent('keydown', UP_ARROW, undefined, {shift: true});

        dispatchFakeEvent(listOptions[3].nativeElement, 'focus');
        expect(manager.activeItemIndex).toBe(3);

        expect(listOptions[1].componentInstance.selected).toBe(false);
        expect(listOptions[2].componentInstance.selected).toBe(false);

        selectionList.componentInstance._keydown(upKeyEvent);
        fixture.detectChanges();

        expect(listOptions[1].componentInstance.selected).toBe(false);
        expect(listOptions[2].componentInstance.selected).toBe(false);
      });

    it('should focus, but not toggle, the next item when pressing SHIFT + DOWN_ARROW ' +
      'in single selection mode', () => {
        const manager = selectionList.componentInstance._keyManager;
        const downKeyEvent = createKeyboardEvent('keydown', DOWN_ARROW, undefined, {shift: true});

        dispatchFakeEvent(listOptions[0].nativeElement, 'focus');
        expect(manager.activeItemIndex).toBe(0);

        expect(listOptions[1].componentInstance.selected).toBe(false);
        expect(listOptions[2].componentInstance.selected).toBe(false);

        selectionList.componentInstance._keydown(downKeyEvent);
        fixture.detectChanges();

        expect(listOptions[1].componentInstance.selected).toBe(false);
        expect(listOptions[2].componentInstance.selected).toBe(false);
      });

  });
});

describe('MatSelectionList with forms', () => {

  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      imports: [MatListModule, FormsModule, ReactiveFormsModule],
      declarations: [
        SelectionListWithModel,
        SelectionListWithFormControl,
        SelectionListWithPreselectedOption,
        SelectionListWithPreselectedOptionAndModel,
        SelectionListWithPreselectedFormControlOnPush,
        SelectionListWithCustomComparator,
      ]
    });

    TestBed.compileComponents();
  }));

  describe('and ngModel', () => {
    let fixture: ComponentFixture<SelectionListWithModel>;
    let selectionListDebug: DebugElement;
    let listOptions: MatListOption[];
    let ngModel: NgModel;

    beforeEach(() => {
      fixture = TestBed.createComponent(SelectionListWithModel);
      fixture.detectChanges();

      selectionListDebug = fixture.debugElement.query(By.directive(MatSelectionList))!;
      ngModel = selectionListDebug.injector.get<NgModel>(NgModel);
      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
        .map(optionDebugEl => optionDebugEl.componentInstance);
    });

    it('should update the model if an option got selected programmatically', fakeAsync(() => {
      expect(fixture.componentInstance.selectedOptions.length)
        .toBe(0, 'Expected no options to be selected by default');

      listOptions[0].toggle();
      fixture.detectChanges();

      tick();

      expect(fixture.componentInstance.selectedOptions.length)
        .toBe(1, 'Expected first list option to be selected');
    }));

    it('should update the model if an option got clicked', fakeAsync(() => {
      expect(fixture.componentInstance.selectedOptions.length)
        .toBe(0, 'Expected no options to be selected by default');

      dispatchFakeEvent(listOptions[0]._getHostElement(), 'click');
      fixture.detectChanges();

      tick();

      expect(fixture.componentInstance.selectedOptions.length)
        .toBe(1, 'Expected first list option to be selected');
    }));

    it('should update the options if a model value is set', fakeAsync(() => {
      expect(fixture.componentInstance.selectedOptions.length)
        .toBe(0, 'Expected no options to be selected by default');

      fixture.componentInstance.selectedOptions = ['opt3'];
      fixture.detectChanges();

      tick();

      expect(fixture.componentInstance.selectedOptions.length)
        .toBe(1, 'Expected first list option to be selected');
    }));

    it('should not mark the model as touched when the list is blurred', fakeAsync(() => {
      expect(ngModel.touched)
        .toBe(false, 'Expected the selection-list to be untouched by default.');

      dispatchFakeEvent(selectionListDebug.nativeElement, 'blur');
      fixture.detectChanges();
      tick();

      expect(ngModel.touched).toBe(false, 'Expected the selection-list to remain untouched.');
    }));

    it('should mark the model as touched when a list item is blurred', fakeAsync(() => {
      expect(ngModel.touched)
        .toBe(false, 'Expected the selection-list to be untouched by default.');

      dispatchFakeEvent(fixture.nativeElement.querySelector('.mat-list-option'), 'blur');
      fixture.detectChanges();
      tick();

      expect(ngModel.touched)
        .toBe(true, 'Expected the selection-list to be touched after an item is blurred.');
    }));

    it('should be pristine by default', fakeAsync(() => {
      fixture = TestBed.createComponent(SelectionListWithModel);
      fixture.componentInstance.selectedOptions = ['opt2'];
      fixture.detectChanges();

      ngModel =
        fixture.debugElement.query(By.directive(MatSelectionList))!.injector.get<NgModel>(NgModel);
      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
        .map(optionDebugEl => optionDebugEl.componentInstance);

      // Flush the initial tick to ensure that every action from the ControlValueAccessor
      // happened before the actual test starts.
      tick();

      expect(ngModel.pristine)
        .toBe(true, 'Expected the selection-list to be pristine by default.');

      listOptions[1].toggle();
      fixture.detectChanges();

      tick();

      expect(ngModel.pristine)
        .toBe(false, 'Expected the selection-list to be dirty after state change.');
    }));

    it('should remove a selected option from the value on destroy', fakeAsync(() => {
      listOptions[1].selected = true;
      listOptions[2].selected = true;

      fixture.detectChanges();

      expect(fixture.componentInstance.selectedOptions).toEqual(['opt2', 'opt3']);

      fixture.componentInstance.options.pop();
      fixture.detectChanges();
      tick();

      expect(fixture.componentInstance.selectedOptions).toEqual(['opt2']);
    }));

    it('should update the model if an option got selected via the model', fakeAsync(() => {
      expect(fixture.componentInstance.selectedOptions).toEqual([]);

      selectionListDebug.componentInstance.selectedOptions.select(listOptions[0]);
      fixture.detectChanges();
      tick();

      expect(fixture.componentInstance.selectedOptions).toEqual(['opt1']);
    }));

    it('should not dispatch the model change event if nothing changed using selectAll', () => {
      expect(fixture.componentInstance.modelChangeSpy).not.toHaveBeenCalled();

      selectionListDebug.componentInstance.selectAll();
      fixture.detectChanges();

      expect(fixture.componentInstance.modelChangeSpy).toHaveBeenCalledTimes(1);

      selectionListDebug.componentInstance.selectAll();
      fixture.detectChanges();

      expect(fixture.componentInstance.modelChangeSpy).toHaveBeenCalledTimes(1);
    });

    it('should not dispatch the model change event if nothing changed using selectAll', () => {
      expect(fixture.componentInstance.modelChangeSpy).not.toHaveBeenCalled();

      selectionListDebug.componentInstance.deselectAll();
      fixture.detectChanges();

      expect(fixture.componentInstance.modelChangeSpy).not.toHaveBeenCalled();
    });

    it('should be able to programmatically set an array with duplicate values', fakeAsync(() => {
      fixture.componentInstance.options = ['one', 'two', 'two', 'two', 'three'];
      fixture.detectChanges();
      tick();

      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
          .map(optionDebugEl => optionDebugEl.componentInstance);

      fixture.componentInstance.selectedOptions = ['one', 'two', 'two'];
      fixture.detectChanges();
      tick();

      expect(listOptions.map(option => option.selected)).toEqual([true, true, true, false, false]);
    }));

    it('should only be in the tab order if it has options', () => {
      expect(selectionListDebug.componentInstance.options.length > 0).toBe(true);
      expect(selectionListDebug.nativeElement.tabIndex).toBe(0);

      fixture.componentInstance.options = [];
      fixture.detectChanges();

      expect(selectionListDebug.nativeElement.tabIndex).toBe(-1);
    });

  });

  describe('and formControl', () => {
    let fixture: ComponentFixture<SelectionListWithFormControl>;
    let listOptions: MatListOption[];
    let selectionList: MatSelectionList;

    beforeEach(() => {
      fixture = TestBed.createComponent(SelectionListWithFormControl);
      fixture.detectChanges();

      selectionList = fixture.debugElement.query(By.directive(MatSelectionList))!.componentInstance;
      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
        .map(optionDebugEl => optionDebugEl.componentInstance);
    });

    it('should be able to disable options from the control', () => {
      expect(selectionList.disabled)
        .toBe(false, 'Expected the selection list to be enabled.');
      expect(listOptions.every(option => !option.disabled))
        .toBe(true, 'Expected every list option to be enabled.');

      fixture.componentInstance.formControl.disable();
      fixture.detectChanges();

      expect(selectionList.disabled)
        .toBe(true, 'Expected the selection list to be disabled.');
      expect(listOptions.every(option => option.disabled))
        .toBe(true, 'Expected every list option to be disabled.');
    });

    it('should be able to update the disabled property after form control disabling', () => {
      expect(listOptions.every(option => !option.disabled))
        .toBe(true, 'Expected every list option to be enabled.');

      fixture.componentInstance.formControl.disable();
      fixture.detectChanges();

      expect(listOptions.every(option => option.disabled))
        .toBe(true, 'Expected every list option to be disabled.');

      // Previously the selection list has been disabled through FormControl#disable. Now we
      // want to verify that we can still change the disabled state through updating the disabled
      // property. Calling FormControl#disable should not lock the disabled property.
      // See: https://github.com/angular/material2/issues/12107
      selectionList.disabled = false;
      fixture.detectChanges();

      expect(listOptions.every(option => !option.disabled))
        .toBe(true, 'Expected every list option to be enabled.');
    });

    it('should be able to set the value through the form control', () => {
      expect(listOptions.every(option => !option.selected))
        .toBe(true, 'Expected every list option to be unselected.');

      fixture.componentInstance.formControl.setValue(['opt2', 'opt3']);
      fixture.detectChanges();

      expect(listOptions[1].selected).toBe(true, 'Expected second option to be selected.');
      expect(listOptions[2].selected).toBe(true, 'Expected third option to be selected.');

      fixture.componentInstance.formControl.setValue(null);
      fixture.detectChanges();

      expect(listOptions.every(option => !option.selected))
        .toBe(true, 'Expected every list option to be unselected.');
    });

    it('should deselect option whose value no longer matches', () => {
      const option = listOptions[1];

      fixture.componentInstance.formControl.setValue(['opt2']);
      fixture.detectChanges();

      expect(option.selected).toBe(true, 'Expected option to be selected.');

      option.value = 'something-different';
      fixture.detectChanges();

      expect(option.selected).toBe(false, 'Expected option not to be selected.');
      expect(fixture.componentInstance.formControl.value).toEqual([]);
    });

    it('should mark options as selected when the value is set before they are initialized', () => {
      fixture.destroy();
      fixture = TestBed.createComponent(SelectionListWithFormControl);

      fixture.componentInstance.formControl.setValue(['opt2', 'opt3']);
      fixture.detectChanges();

      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
        .map(optionDebugEl => optionDebugEl.componentInstance);

      expect(listOptions[1].selected).toBe(true, 'Expected second option to be selected.');
      expect(listOptions[2].selected).toBe(true, 'Expected third option to be selected.');
    });

    it('should not clear the form control when the list is destroyed', fakeAsync(() => {
      const option = listOptions[1];

      option.selected = true;
      fixture.detectChanges();

      expect(fixture.componentInstance.formControl.value).toEqual(['opt2']);

      fixture.componentInstance.renderList = false;
      fixture.detectChanges();
      tick();
      fixture.detectChanges();

      expect(fixture.componentInstance.formControl.value).toEqual(['opt2']);
    }));

    it('should mark options added at a later point as selected', () => {
      fixture.componentInstance.formControl.setValue(['opt4']);
      fixture.detectChanges();

      fixture.componentInstance.renderExtraOption = true;
      fixture.detectChanges();

      listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
        .map(optionDebugEl => optionDebugEl.componentInstance);

      expect(listOptions.length).toBe(4);
      expect(listOptions[3].selected).toBe(true);
    });

  });

  describe('preselected values', () => {
    it('should add preselected options to the model value', fakeAsync(() => {
      const fixture = TestBed.createComponent(SelectionListWithPreselectedOption);
      const listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
          .map(optionDebugEl => optionDebugEl.componentInstance);

      fixture.detectChanges();
      tick();

      expect(listOptions[1].selected).toBe(true);
      expect(fixture.componentInstance.selectedOptions).toEqual(['opt2']);
    }));

    it('should handle preselected option both through the model and the view', fakeAsync(() => {
      const fixture = TestBed.createComponent(SelectionListWithPreselectedOptionAndModel);
      const listOptions = fixture.debugElement.queryAll(By.directive(MatListOption))
          .map(optionDebugEl => optionDebugEl.componentInstance);

      fixture.detectChanges();
      tick();

      expect(listOptions[0].selected).toBe(true);
      expect(listOptions[1].selected).toBe(true);
      expect(fixture.componentInstance.selectedOptions).toEqual(['opt1', 'opt2']);
    }));

    it('should show the item as selected when preselected inside OnPush parent', fakeAsync(() => {
      const fixture = TestBed.createComponent(SelectionListWithPreselectedFormControlOnPush);
      fixture.detectChanges();

      const option = fixture.debugElement.queryAll(By.directive(MatListOption))[1];

      fixture.detectChanges();
      flush();
      fixture.detectChanges();

      expect(option.componentInstance.selected).toBe(true);
      expect(option.nativeElement.querySelector('.mat-pseudo-checkbox-checked')).toBeTruthy();
    }));

  });

  describe('with custom compare function', () => {
    it('should use a custom comparator to determine which options are selected', fakeAsync(() => {
      const fixture = TestBed.createComponent(SelectionListWithCustomComparator);
      const testComponent = fixture.componentInstance;

      testComponent.compareWith = jasmine.createSpy('comparator', (o1: any, o2: any) => {
        return o1 && o2 && o1.id === o2.id;
      }).and.callThrough();

      testComponent.selectedOptions = [{id: 2, label: 'Two'}];
      fixture.detectChanges();
      tick();

      expect(testComponent.compareWith).toHaveBeenCalled();
      expect(testComponent.optionInstances.toArray()[1].selected).toBe(true);
    }));
  });
});

@Component({template: `
  <mat-selection-list
    id="selection-list-1"
    (selectionChange)="onSelectionChange($event)"
    [disableRipple]="listRippleDisabled"
    [color]="selectionListColor"
    [multiple]="multiple">
    <mat-list-option checkboxPosition="before" disabled="true" value="inbox"
                     [color]="firstOptionColor">
      Inbox (disabled selection-option)
    </mat-list-option>
    <mat-list-option id="testSelect" checkboxPosition="before" class="test-native-focus"
                    value="starred">
      Starred
    </mat-list-option>
    <mat-list-option checkboxPosition="before" value="sent-mail">
      Sent Mail
    </mat-list-option>
    <mat-list-option checkboxPosition="before" value="archive">
      Archive
    </mat-list-option>
    <mat-list-option checkboxPosition="before" value="drafts" *ngIf="showLastOption">
      Drafts
    </mat-list-option>
  </mat-selection-list>`})
class SelectionListWithListOptions {
  showLastOption = true;
  listRippleDisabled = false;
  multiple = true;
  selectionListColor: ThemePalette;
  firstOptionColor: ThemePalette;

  onSelectionChange(_change: MatSelectionListChange) {}
}

@Component({template: `
  <mat-selection-list id="selection-list-2">
    <mat-list-option checkboxPosition="after">
      Inbox (disabled selection-option)
    </mat-list-option>
    <mat-list-option id="testSelect" checkboxPosition="after">
      Starred
    </mat-list-option>
    <mat-list-option checkboxPosition="after">
      Sent Mail
    </mat-list-option>
    <mat-list-option checkboxPosition="after">
      Drafts
    </mat-list-option>
  </mat-selection-list>`})
class SelectionListWithCheckboxPositionAfter {
}

@Component({template: `
  <mat-selection-list id="selection-list-3" [disabled]="disabled">
    <mat-list-option checkboxPosition="after">
      Inbox (disabled selection-option)
    </mat-list-option>
    <mat-list-option id="testSelect" checkboxPosition="after">
      Starred
    </mat-list-option>
    <mat-list-option checkboxPosition="after">
      Sent Mail
    </mat-list-option>
    <mat-list-option checkboxPosition="after">
      Drafts
    </mat-list-option>
  </mat-selection-list>`})
class SelectionListWithListDisabled {
  disabled: boolean = true;
}

@Component({template: `
  <mat-selection-list>
    <mat-list-option [disabled]="disableItem">Item</mat-list-option>
  </mat-selection-list>
  `})
class SelectionListWithDisabledOption {
  disableItem: boolean = false;
}

@Component({template: `
  <mat-selection-list>
    <mat-list-option [selected]="true">Item</mat-list-option>
  </mat-selection-list>`})
class SelectionListWithSelectedOption {
}

@Component({
  template: `
  <mat-selection-list>
    <mat-list-option [selected]="true" [value]="itemValue">Item</mat-list-option>
  </mat-selection-list>`
})
class SelectionListWithSelectedOptionAndValue {
  itemValue = 'item1';
}

@Component({template: `
  <mat-selection-list id="selection-list-4">
    <mat-list-option checkboxPosition="after" class="test-focus" id="123">
      Inbox
    </mat-list-option>
  </mat-selection-list>`})
class SelectionListWithOnlyOneOption {
}

@Component({
  template: `
    <mat-selection-list [(ngModel)]="selectedOptions" (ngModelChange)="modelChangeSpy()">
      <mat-list-option *ngFor="let option of options" [value]="option">{{option}}</mat-list-option>
    </mat-selection-list>`
})
class SelectionListWithModel {
  modelChangeSpy = jasmine.createSpy('model change spy');
  selectedOptions: string[] = [];
  options = ['opt1', 'opt2', 'opt3'];
}

@Component({
  template: `
    <mat-selection-list [formControl]="formControl" *ngIf="renderList">
      <mat-list-option value="opt1">Option 1</mat-list-option>
      <mat-list-option value="opt2">Option 2</mat-list-option>
      <mat-list-option value="opt3">Option 3</mat-list-option>
      <mat-list-option value="opt4" *ngIf="renderExtraOption">Option 4</mat-list-option>
    </mat-selection-list>
  `
})
class SelectionListWithFormControl {
  formControl = new FormControl();
  renderList = true;
  renderExtraOption = false;
}

@Component({
  template: `
    <mat-selection-list [(ngModel)]="selectedOptions">
      <mat-list-option value="opt1">Option 1</mat-list-option>
      <mat-list-option value="opt2" selected>Option 2</mat-list-option>
    </mat-selection-list>`
})
class SelectionListWithPreselectedOption {
  selectedOptions: string[];
}

@Component({
  template: `
    <mat-selection-list [(ngModel)]="selectedOptions">
      <mat-list-option value="opt1">Option 1</mat-list-option>
      <mat-list-option value="opt2" selected>Option 2</mat-list-option>
    </mat-selection-list>`
})
class SelectionListWithPreselectedOptionAndModel {
  selectedOptions = ['opt1'];
}

@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <mat-selection-list [formControl]="formControl">
      <mat-list-option *ngFor="let opt of opts" [value]="opt">{{opt}}</mat-list-option>
    </mat-selection-list>
  `
})
class SelectionListWithPreselectedFormControlOnPush {
  opts = ['opt1', 'opt2', 'opt3'];
  formControl = new FormControl(['opt2']);
}

@Component({
  template: `
    <mat-selection-list [(ngModel)]="selectedOptions" [compareWith]="compareWith">
      <mat-list-option *ngFor="let option of options" [value]="option">
        {{option.label}}
      </mat-list-option>
    </mat-selection-list>`
})
class SelectionListWithCustomComparator {
  @ViewChildren(MatListOption) optionInstances: QueryList<MatListOption>;
  selectedOptions: {id: number, label: string}[] = [];
  compareWith?: (o1: any, o2: any) => boolean;
  options = [
    {id: 1, label: 'One'},
    {id: 2, label: 'Two'},
    {id: 3, label: 'Three'}
  ];
}

@Component({
  template: `
    <mat-selection-list [compareWith]="compareWith">
      <mat-list-option [value]="value" [selected]="value.id === 1">
        One
      </mat-list-option>
    </mat-selection-list>`
})
class SelectionListWithChangingOptionValue {
  compareWith = (o1: any, o2: any) => o1 && o2 && o1.id === o2.id;
  value = {id: 1};
}

@Component({
  template: `
    <mat-selection-list>
      <mat-list-option>
        <div mat-list-avatar>I</div>
        Inbox
      </mat-list-option>
    </mat-selection-list>
  `
})
class SelectionListWithAvatar {
}

@Component({
  template: `
    <mat-selection-list>
      <mat-list-option>
        <div mat-list-icon>I</div>
        Inbox
      </mat-list-option>
    </mat-selection-list>
  `
})
class SelectionListWithIcon {
}

@Component({
  // Note the blank `ngSwitch` which we need in order to hit the bug that we're testing.
  template: `
    <mat-selection-list>
      <ng-container [ngSwitch]="true">
        <mat-list-option [value]="1">One</mat-list-option>
        <mat-list-option [value]="2">Two</mat-list-option>
      </ng-container>
    </mat-selection-list>`
})
class SelectionListWithIndirectChildOptions {
  @ViewChildren(MatListOption) optionInstances: QueryList<MatListOption>;
}

// Note the blank `ngSwitch` which we need in order to hit the bug that we're testing.
@Component({
  template: `
  <mat-selection-list>
    <mat-list-option>
      <ng-container [ngSwitch]="true">
        <h3 mat-line>Item</h3>
        <p mat-line>Item description</p>
      </ng-container>
    </mat-list-option>
  </mat-selection-list>`
})
class SelectionListWithIndirectDescendantLines {
}


text:
<?php

namespace perf\Http;

/**
 * This class allows to redirect visitors to other web sites / pages, using HTTP header and HTTP status codes.
 *
 * @package perf
 */
class Redirector
{

    /**
     * List of allowed HTTP status codes for redirecting.
     *
     * @var int[]
     */
    private $allowedStatusCodes = array(
        Status::MULTIPLE_CHOICES,
        Status::MOVED_PERMANENTLY,
        Status::MOVED_TEMPORARILY,
        Status::FOUND,
        Status::SEE_OTHER,
        Status::NOT_MODIFIED,
        Status::USE_PROXY,
        Status::TEMPORARY_REDIRECT,
    );

    /**
     * Base URL to use when redirecting internally.
     *
     * @var string
     */
    private $baseUrl;

    /**
     * Sets base URL to use when redirecting internally, including scheme.
     *
     * @param mixed $baseUrl string / null
     * @return void
     */
    public function setBaseUrl($baseUrl)
    {
        $this->baseUrl = is_null($baseUrl)
                       ? null
                       : (string) $baseUrl;
    }

    /**
     * Makes an internal HTTP redirect (ie, on the same HTTP host than the current page being browsed)
     *   with specified HTTP status code.
     *
     * @param string $path path to redirect visitor to, on the current HTTP host being browsed.
     * @param int $statusCode HTTP status code to use for the redirect.
     * @return void
     */
    public function internal($path, $statusCode = Status::FOUND)
    {
        $path = (string) $path;

        $baseUrl = $this->getBaseUrl();

        $this->redirect($baseUrl . $path, $statusCode);
    }

    /**
     * Returns the base URL to use when redirecting internally.
     *
     * @return string
     * @throws \RuntimeException
     */
    private function getBaseUrl()
    {
        if (isset($this->baseUrl)) {
            return $this->baseUrl;
        }

        throw new \RuntimeException('No base URL set.');
    }

    /**
     * Makes an external HTTP redirect (ie, on a different HTTP host than the current page being browsed)
     *   with specified HTTP status code.
     *
     * @param string $url URL to redirect to.
     * @param int $statusCode HTTP status code to use for the redirect.
     * @return void
     */
    public function external($url, $statusCode = Status::FOUND)
    {
        $this->redirect($url, $statusCode);
    }

    /**
     * Makes a HTTP redirect with specified HTTP status code.
     *
     * @param string $url URL to redirect to.
     * @param int $statusCode HTTP status code to use for the redirect.
     * @return void
     * @throws \DomainException
     */
    private function redirect($url, $statusCode)
    {
        $statusCode = (int)    $statusCode;
        $url        = (string) $url;

        if (!in_array($statusCode, $this->allowedStatusCodes, true)) {
            throw new \DomainException("HTTP status code not allowed for redirect: '{$statusCode}'.");
        }

        Status::send($statusCode);

        header('Location: ' . $url);
    }
}


text:
@interface SZAddWorkingHoursView : JCRBlurView

@property (copy, nonatomic) void (^selectedBlock)(SZLabor *labor) ;

@property (nonatomic, strong) NSMutableArray *selectedTypes;

@property (nonatomic , assign) BOOL zhongduan;

@end


text:
require 'rubygems'
require 'net/ssh'
require 'net/scp'

#SCP helper
module Upload
  #Do an scp source_file dest_host:dest_file using the keyfile for authentication.
  # @param source_file [String] The file to copy
  # @param dest_file [String] The remote file name we are copying to
  # @param dest_host [String] The host name we are copying to
  # @param keyfile [String] The filename of the id_rsa file we are using to authenticate with.
  def self.upload_file(source_file, dest_file, dest_host, keyfile)
  	begin
  		Net::SCP.start(dest_host, 'root', :keys => [ keyfile ]) do |scp|
  	    scp.upload!( source_file, dest_file )
  		end
    rescue Exception => error
      $stderr.puts "upload_file('#{source_file}', '#{dest_file}', '#{dest_host}', '#{keyfile}') Scp failed with error: #{error}"
    end
  end
end


text:
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {
  NgModule,
  ApplicationRef
} from '@angular/core';
import {
  removeNgStyles,
  createNewHosts,
  createInputTransfer
} from '@angularclass/hmr';
import {
  RouterModule,
  PreloadAllModules
} from '@angular/router';
import { ReactiveFormsModule } from '@angular/forms';

/*
 * Platform and Environment providers/directives/pipes
 */
import { ENV_PROVIDERS } from './environment';
import { ROUTES } from './app.routes';
// App is our top level component
import { AppComponent } from './app.component';
import { APP_RESOLVER_PROVIDERS } from './app.resolver';
import { AppState, InternalStateType } from './app.service';
import { HomeComponent } from './home';
import { AboutComponent } from './about';
import { NoContentComponent } from './no-content';
import { XLargeDirective } from './home/x-large';

import '../styles/styles.scss';
import '../styles/headings.css';

/**
 * mQuBits
 */
import { RegisterComponent } from './mQuBits/components/users/register/register.component';
import { OAuthService } from './mQuBits/services/oauth/o-auth.service';
import { Handler } from './mQuBits/services/handler';
import { ProfileComponent } from './mQuBits/components/users/profile/profile.component';
import { LoginComponent } from './mQuBits/components/users/login/login.component';

// Application wide providers
const APP_PROVIDERS = [
  ...APP_RESOLVER_PROVIDERS,
  AppState
];

type StoreType = {
  state: InternalStateType,
  restoreInputValues: () => void,
  disposeOldHosts: () => void
};

/**
 * `AppModule` is the main entry point into Angular2's bootstraping process
 */
@NgModule({
  bootstrap: [AppComponent],
  declarations: [
    AppComponent,
    AboutComponent,
    HomeComponent,
    NoContentComponent,
    XLargeDirective,
    RegisterComponent,
    ProfileComponent,
    LoginComponent
  ],
  imports: [ // import Angular's modules
    BrowserModule,
    FormsModule,
    HttpModule,
    RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules }),
    ReactiveFormsModule
  ],
  providers: [ // expose our Services and Providers into Angular's dependency injection
    ENV_PROVIDERS,
    APP_PROVIDERS,
    OAuthService,
    Handler
  ]
})
export class AppModule {

  constructor(
    public appRef: ApplicationRef,
    public appState: AppState
  ) { }

  public hmrOnInit(store: StoreType) {
    if (!store || !store.state) {
      return;
    }
    console.log('HMR store', JSON.stringify(store, null, 2));
    // set state
    this.appState._state = store.state;
    // set input values
    if ('restoreInputValues' in store) {
      let restoreInputValues = store.restoreInputValues;
      setTimeout(restoreInputValues);
    }

    this.appRef.tick();
    delete store.state;
    delete store.restoreInputValues;
  }

  public hmrOnDestroy(store: StoreType) {
    const cmpLocation = this.appRef.components.map((cmp) => cmp.location.nativeElement);
    // save state
    const state = this.appState._state;
    store.state = state;
    // recreate root elements
    store.disposeOldHosts = createNewHosts(cmpLocation);
    // save input values
    store.restoreInputValues = createInputTransfer();
    // remove styles
    removeNgStyles();
  }

  public hmrAfterDestroy(store: StoreType) {
    // display new elements
    store.disposeOldHosts();
    delete store.disposeOldHosts;
  }

}


text:
React TweenOne Component

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![gemnasium deps][gemnasium-image]][gemnasium-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/rc-tween-one.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-tween-one
[travis-image]: https://img.shields.io/travis/react-component/tween-one.svg?style=flat-square
[travis-url]: https://travis-ci.org/react-component/tween-one
[coveralls-image]: https://img.shields.io/coveralls/react-component/tween-one.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/tween-one?branch=master
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/tween-one.svg?style=flat-square
[gemnasium-url]: https://gemnasium.com/react-component/tween-one
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/rc-tween-one.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-tween-one

## Browser Support

|![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)|
| --- | --- | --- | --- | --- |
| IE 9+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |

## Development

```
npm install
npm start
```

## Example

http://localhost:8100/examples/

http://react-component.github.io/tween-one/

## install

[![rc-tween-one](https://nodei.co/npm/rc-tween-one.png)](https://npmjs.org/package/rc-tween-one)

## Usage

```js
var TweenOne = require('rc-tween-one');
var React = require('react');
React.render(<TweenOne animation={{x:100}}>
  demo
</TweenOne>, container);
```

### Plugin

```
var TweenOne = require('rc-tween-one');
var SvgDrawPlugin = require('rc-tween-one/lib/plugin/SvgDrawPlugin');
Tween.plugins.push(SvgDrawPlugin);
```

### TweenOneGroup
```js
var TweenOne = require('rc-tween-one');
var React = require('react');
var TweenOneGroup = TweenOne.TweenOneGroup;
React.render(<TweenOneGroup>
  <div key="0">demo</div>
  <div key="1">demo</div>
</TweenOneGroup>, container);
```

## API

中文文档

### props

| name      | type           | default | description    |
|------------|----------------|---------|----------------|
| animation  | object / array | null    | animate configure parameters |
| paused      | boolean        | false   | animate pause |
| reverse    | boolean        | false   | animate revers |
| reverseDelay | number       | 0       | animate revers start delay |
| onChange   | func           | null    | when the animation change called, callback({ moment, item, tween, index, mode}) |
| moment     | number         | null    | set the current frame    |
| attr       | string         | `style` | `style` or `attr`, `attr` is tag attribute. when morph SVG must be `attr`.  |
| willChange | boolean        | true    | open will-change style. |
| resetStyleBool | boolean    | false   | update animation data, reset init style |
| updateReStart | boolean     | true    | update animation data, re start animate |
| component  | string / React.Element  | `div`   | component tag  |

### animation = { }

> transform need to set the initial value, must be set in the style;

> filter => `grayScale`, `sepia`, `hueRotate`, `invert`, `brightness`, `contrast`, `blur`;  { blur: '5px' }  Unit must bring.

| name      | type           | default | description    |
|------------|----------------|---------|----------------|
| type       | string         | `to`    | play type: `to` `from`|
| in style   | string / number| null  | CSS style value: `translateX` `rotateX` `color` `marginTop` or `grayScale`, `sepia`, `hueRotate`, `invert`, `brightness`, `contrast`, `blur` or gsap: `x` `y`... |
| duration   |  number        | 450     | animate duration     |
| delay      | number         | 0       | animate delay  |
| repeat     | number         | 0       | animate repeat, To repeat indefinitely, use  -1 |
| repeatDelay| number         | 0       | repeat start delay |
| appearTo   | number         | null    | Add to the specified time |
| yoyo       | boolean        | false   | if `true`, every other repeat cycle will run in the opposite direction so that the tween appears to go back and forth (forward then backward).  |
| ease       | string / func         | `easeInOutQuad` | animate ease. [refer](http://easings.net/en)  |
| bezier     | object         | null    | bezier curve animate |
| onStart    | func           | null    | A function that should be called when the tween begins, callback(e), e: { index, target }  |
| onUpdate   | func           | null    | A function that should be called every time the animate updates, callback(e), e: { index, target,  ratio }   |
| onComplete | func           | null    | A function that should be called when the animate has completed, callback(e), e: { index, target }  |
| onRepeat   | func           | null    | A function that should be called each time the animate repeats, callback(e), e: { index, target }  |

> Cannot be used at the same time `reverse` and `repeat: -1`.

### animation =[ ] is timeline

### ease: function

path easing;

```jsx

const path = 'M0,100 C30,60 0,20 50,50 C70,70 60,0 100,0';
const ease = Tween.easing.path(path);

```

### BezierPlugin

bezier = { }

| name      | type           | default | description    |
|------------|----------------|---------|----------------|
| type       | string         | `soft`  | `thru`, `soft`, `quadratic`, `cubic` |
| autoRotate | boolean        | false   | to automatically rotate the target according to its position on the Bezier path  |
| vars       | array          | null    | bezier point data,as: `{x:100,y:100}` |

> bezier API refer to [gsap BezierPlugin](http://greensock.com/docs/#/HTML5/GSAP/Plugins/BezierPlugin/)

### SvgDrawPlugin

SVGDraw = string or number;

{ SVGDraw: 30 } or { SVGDraw: 'start end' } start and end values can be `%`;

### SvgMorphPlugin

svg polygon or path values: polygon is points, path is d; [demo](http://react-component.github.io/tween-one/examples/svg.html)

### PathPlugin

path = string or object;

string: `animation={{ path: 'M0,100 C30,60 0,20 50,50 C70,70 60,0 100,0' }}`,  default:  x, y, rotate;

object: `animation={{ path: { x: path, y: path, rotate: path } }}`, can be controlled from their own needs.

## TweenOneGroup

| name      | type           | default | description    |
|------------|----------------|---------|----------------|
| appear    |  boolean       |  true   |  whether support appear anim |
| enter     | object / array / func | `{ x: 30, opacity: 0, type: 'from' }` | enter anim twee-one data. when array is tween-one timeline, func refer to queue-anim  |
| leave     | object / array / func | `{ x: 30, opacity: 0 }` | leave anim twee-one data. when array is tween-one timeline, func refer to queue-anim  |
| onEnd     |  func          | -    | one animation end callback |
| animatingClassName | array | `['tween-one-entering', 'tween-one-leaving']` | className to every element of animating |
| resetStyleBool   |  boolean   | true  | whether to animation reset the style every time |
| willChange |  boolean       | true   |  open child will-change style, transfer to child  |
| component | 	React.Element/String | div  |  component tag  |


text:
package main

import (
	"fmt"
	"os/exec"
	"regexp"
	"strings"
	"testing"
	"time"

	"github.com/docker/docker/pkg/timeutils"
)

// This used to work, it test a log of PageSize-1 (gh#4851)
func TestLogsContainerSmallerThanPage(t *testing.T) {
	testLen := 32767
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	if len(out) != testLen+1 {
		t.Fatalf("Expected log length of %d, received %d\n", testLen+1, len(out))
	}

	deleteContainer(cleanedContainerID)

	logDone("logs - logs container running echo smaller than page size")
}

// Regression test: When going over the PageSize, it used to panic (gh#4851)
func TestLogsContainerBiggerThanPage(t *testing.T) {
	testLen := 32768
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	if len(out) != testLen+1 {
		t.Fatalf("Expected log length of %d, received %d\n", testLen+1, len(out))
	}

	deleteContainer(cleanedContainerID)

	logDone("logs - logs container running echo bigger than page size")
}

// Regression test: When going much over the PageSize, it used to block (gh#4851)
func TestLogsContainerMuchBiggerThanPage(t *testing.T) {
	testLen := 33000
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	if len(out) != testLen+1 {
		t.Fatalf("Expected log length of %d, received %d\n", testLen+1, len(out))
	}

	deleteContainer(cleanedContainerID)

	logDone("logs - logs container running echo much bigger than page size")
}

func TestLogsTimestamps(t *testing.T) {
	testLen := 100
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))

	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", "-t", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	lines := strings.Split(out, "\n")

	if len(lines) != testLen+1 {
		t.Fatalf("Expected log %d lines, received %d\n", testLen+1, len(lines))
	}

	ts := regexp.MustCompile(`^.* `)

	for _, l := range lines {
		if l != "" {
			_, err := time.Parse(timeutils.RFC3339NanoFixed+" ", ts.FindString(l))
			if err != nil {
				t.Fatalf("Failed to parse timestamp from %v: %v", l, err)
			}
			if l[29] != 'Z' { // ensure we have padded 0's
				t.Fatalf("Timestamp isn't padded properly: %s", l)
			}
		}
	}

	deleteContainer(cleanedContainerID)

	logDone("logs - logs with timestamps")
}

func TestLogsSeparateStderr(t *testing.T) {
	msg := "stderr_log"
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))

	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID)
	stdout, stderr, _, err := runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	if stdout != "" {
		t.Fatalf("Expected empty stdout stream, got %v", stdout)
	}

	stderr = strings.TrimSpace(stderr)
	if stderr != msg {
		t.Fatalf("Expected %v in stderr stream, got %v", msg, stderr)
	}

	deleteContainer(cleanedContainerID)

	logDone("logs - separate stderr (without pseudo-tty)")
}

func TestLogsStderrInStdout(t *testing.T) {
	msg := "stderr_log"
	runCmd := exec.Command(dockerBinary, "run", "-d", "-t", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))

	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", cleanedContainerID)
	stdout, stderr, _, err := runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	if stderr != "" {
		t.Fatalf("Expected empty stderr stream, got %v", stdout)
	}

	stdout = strings.TrimSpace(stdout)
	if stdout != msg {
		t.Fatalf("Expected %v in stdout stream, got %v", msg, stdout)
	}

	deleteContainer(cleanedContainerID)

	logDone("logs - stderr in stdout (with pseudo-tty)")
}

func TestLogsTail(t *testing.T) {
	testLen := 100
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))

	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", "--tail", "5", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	lines := strings.Split(out, "\n")

	if len(lines) != 6 {
		t.Fatalf("Expected log %d lines, received %d\n", 6, len(lines))
	}

	logsCmd = exec.Command(dockerBinary, "logs", "--tail", "all", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	lines = strings.Split(out, "\n")

	if len(lines) != testLen+1 {
		t.Fatalf("Expected log %d lines, received %d\n", testLen+1, len(lines))
	}

	logsCmd = exec.Command(dockerBinary, "logs", "--tail", "random", cleanedContainerID)
	out, _, _, err = runCommandWithStdoutStderr(logsCmd)
	if err != nil {
		t.Fatalf("failed to log container: %s, %v", out, err)
	}

	lines = strings.Split(out, "\n")

	if len(lines) != testLen+1 {
		t.Fatalf("Expected log %d lines, received %d\n", testLen+1, len(lines))
	}

	deleteContainer(cleanedContainerID)
	logDone("logs - logs tail")
}

func TestLogsFollowStopped(t *testing.T) {
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "echo", "hello")

	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	exec.Command(dockerBinary, "wait", cleanedContainerID).Run()

	logsCmd := exec.Command(dockerBinary, "logs", "-f", cleanedContainerID)
	if err := logsCmd.Start(); err != nil {
		t.Fatal(err)
	}

	c := make(chan struct{})
	go func() {
		if err := logsCmd.Wait(); err != nil {
			t.Fatal(err)
		}
		close(c)
	}()

	select {
	case <-c:
	case <-time.After(1 * time.Second):
		t.Fatal("Following logs is hanged")
	}

	deleteContainer(cleanedContainerID)
	logDone("logs - logs follow stopped container")
}

// Regression test for #8832
func TestLogsFollowSlowStdoutConsumer(t *testing.T) {
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 200000;yes X | head -c 200000`)

	out, _, _, err := runCommandWithStdoutStderr(runCmd)
	if err != nil {
		t.Fatalf("run failed with errors: %s, %v", out, err)
	}

	cleanedContainerID := strings.TrimSpace(out)
	defer deleteContainer(cleanedContainerID)

	stopSlowRead := make(chan bool)

	go func() {
		exec.Command(dockerBinary, "wait", cleanedContainerID).Run()
		stopSlowRead <- true
	}()

	logCmd := exec.Command(dockerBinary, "logs", "-f", cleanedContainerID)

	stdout, err := logCmd.StdoutPipe()
	if err != nil {
		t.Fatal(err)
	}

	if err := logCmd.Start(); err != nil {
		t.Fatal(err)
	}

	// First read slowly
	bytes1, err := consumeWithSpeed(stdout, 10, 50*time.Millisecond, stopSlowRead)
	if err != nil {
		t.Fatal(err)
	}

	// After the container has finished we can continue reading fast
	bytes2, err := consumeWithSpeed(stdout, 32*1024, 0, nil)
	if err != nil {
		t.Fatal(err)
	}

	actual := bytes1 + bytes2
	expected := 200000
	if actual != expected {
		t.Fatalf("Invalid bytes read: %d, expected %d", actual, expected)
	}

	logDone("logs - follow slow consumer")
}


text:
package gslb

/**
* Binding class showing the gslbservice that can be bound to gslbsite.
*/
type Gslbsitegslbservicebinding struct {
	/**
	* Service name.
	*/
	Servicename string `json:"servicename,omitempty"`
	/**
	* The cname of the gslb service.
	*/
	Cnameentry string `json:"cnameentry,omitempty"`
	/**
	* IP Address of the gslb service.
	*/
	Ipaddress string `json:"ipaddress,omitempty"`
	/**
	* Port number of the gslb service.
	*/
	Port int `json:"port,omitempty"`
	/**
	* Service type.
	*/
	Servicetype string `json:"servicetype,omitempty"`
	/**
	* State of the gslb service.
	*/
	State string `json:"state,omitempty"`
	/**
	* Name of the GSLB site. If you specify a site name, details of all the site's constituent services are also displayed.
	*/
	Sitename string `json:"sitename,omitempty"`

}