style: fix code style in several files (#31295)

These files have not been formatted properly, due to issues in the
`gulp format*` tasks. See previous commits (or #31295) for more details.

PR Close #31295
This commit is contained in:
George Kalpakas 2019-06-26 21:33:50 +03:00 committed by Kara Erickson
parent 6b7b4ee891
commit 3851544674
6 changed files with 79 additions and 72 deletions

View File

@ -95,16 +95,16 @@ export interface CommitObject {
* The file extension or preprocessor to use for style files. * The file extension or preprocessor to use for style files.
*/ */
export declare enum Style { export declare enum Style {
Css = "css", Css = 'css',
Sass = "sass", Sass = 'sass',
Scss = "scss", Scss = 'scss',
} }
/** /**
* The view encapsulation strategy to use in the initial project. * The view encapsulation strategy to use in the initial project.
*/ */
export declare enum ViewEncapsulation { export declare enum ViewEncapsulation {
Emulated = "Emulated", Emulated = 'Emulated',
Native = "Native", Native = 'Native',
None = "None", None = 'None',
ShadowDom = "ShadowDom" ShadowDom = 'ShadowDom'
} }

View File

@ -458,10 +458,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
if (bindings.size) { if (bindings.size) {
const chainBindings: ChainableBindingInstruction[] = []; const chainBindings: ChainableBindingInstruction[] = [];
bindings.forEach(binding => { bindings.forEach(binding => {
chainBindings.push({ chainBindings.push({sourceSpan: span, value: () => this.convertPropertyBinding(binding)});
sourceSpan: span,
value: () => this.convertPropertyBinding(binding)
});
}); });
this.updateInstructionChain(index, R3.i18nExp, chainBindings); this.updateInstructionChain(index, R3.i18nExp, chainBindings);
this.updateInstruction(index, span, R3.i18nApply, [o.literal(index)]); this.updateInstruction(index, span, R3.i18nApply, [o.literal(index)]);
@ -779,8 +776,11 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
} else { } else {
// [prop]="value" // [prop]="value"
// Collect all the properties so that we can chain into a single function at the end. // Collect all the properties so that we can chain into a single function at the end.
propertyBindings.push( propertyBindings.push({
{name: attrName, sourceSpan: input.sourceSpan, value: () => this.convertPropertyBinding(value), params}); name: attrName,
sourceSpan: input.sourceSpan,
value: () => this.convertPropertyBinding(value), params
});
} }
} else if (inputType === BindingType.Attribute) { } else if (inputType === BindingType.Attribute) {
if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) { if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) {
@ -1038,8 +1038,11 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
if (value !== undefined) { if (value !== undefined) {
this.allocateBindingSlots(value); this.allocateBindingSlots(value);
propertyBindings.push( propertyBindings.push({
{name: input.name, sourceSpan: input.sourceSpan, value: () => this.convertPropertyBinding(value)}); name: input.name,
sourceSpan: input.sourceSpan,
value: () => this.convertPropertyBinding(value)
});
} }
} }
}); });

View File

@ -174,11 +174,13 @@ export interface Directive {
* *
* @Component({ * @Component({
* selector: 'main', * selector: 'main',
* template: ` {{ bankName }} <child-dir (bankNameChange)="onBankNameChange($event)"></child-dir>` * template: `
* {{ bankName }} <child-dir (bankNameChange)="onBankNameChange($event)"></child-dir>
* `
* }) * })
* class MainComponent { * class MainComponent {
* bankName: string; * bankName: string;
* *
* onBankNameChange(bankName: string) { * onBankNameChange(bankName: string) {
* this.bankName = bankName; * this.bankName = bankName;
* } * }

View File

@ -7,16 +7,18 @@
*/ */
import '../util/ng_i18n_closure_mode'; import '../util/ng_i18n_closure_mode';
import {getPluralCase} from '../i18n/localization'; import {getPluralCase} from '../i18n/localization';
import {SRCSET_ATTRS, URI_ATTRS, VALID_ATTRS, VALID_ELEMENTS, getTemplateContent} from '../sanitization/html_sanitizer'; import {SRCSET_ATTRS, URI_ATTRS, VALID_ATTRS, VALID_ELEMENTS, getTemplateContent} from '../sanitization/html_sanitizer';
import {InertBodyHelper} from '../sanitization/inert_body'; import {InertBodyHelper} from '../sanitization/inert_body';
import {_sanitizeUrl, sanitizeSrcset} from '../sanitization/url_sanitizer'; import {_sanitizeUrl, sanitizeSrcset} from '../sanitization/url_sanitizer';
import {addAllToArray} from '../util/array_utils'; import {addAllToArray} from '../util/array_utils';
import {assertDataInRange, assertDefined, assertEqual, assertGreaterThan} from '../util/assert'; import {assertDataInRange, assertDefined, assertEqual, assertGreaterThan} from '../util/assert';
import {attachPatchData} from './context_discovery'; import {attachPatchData} from './context_discovery';
import {bind, setDelayProjection, ɵɵload} from './instructions/all'; import {bind, setDelayProjection, ɵɵload} from './instructions/all';
import {attachI18nOpCodesDebug} from './instructions/lview_debug'; import {attachI18nOpCodesDebug} from './instructions/lview_debug';
import {allocExpando, elementAttributeInternal, elementPropertyInternal, getOrCreateTNode, setInputsForProperty, textBindingInternal, TsickleIssue1009} from './instructions/shared'; import {TsickleIssue1009, allocExpando, elementAttributeInternal, elementPropertyInternal, getOrCreateTNode, setInputsForProperty, textBindingInternal} from './instructions/shared';
import {LContainer, NATIVE} from './interfaces/container'; import {LContainer, NATIVE} from './interfaces/container';
import {COMMENT_MARKER, ELEMENT_MARKER, I18nMutateOpCode, I18nMutateOpCodes, I18nUpdateOpCode, I18nUpdateOpCodes, IcuType, TI18n, TIcu} from './interfaces/i18n'; import {COMMENT_MARKER, ELEMENT_MARKER, I18nMutateOpCode, I18nMutateOpCodes, I18nUpdateOpCode, I18nUpdateOpCodes, IcuType, TI18n, TIcu} from './interfaces/i18n';
import {TElementNode, TIcuContainerNode, TNode, TNodeFlags, TNodeType, TProjectionNode} from './interfaces/node'; import {TElementNode, TIcuContainerNode, TNode, TNodeFlags, TNodeType, TProjectionNode} from './interfaces/node';

View File

@ -771,8 +771,8 @@ function executeActionOnView(
} }
/** /**
* `executeActionOnProjection` performs an operation on the projection specified by `action` (insert, * `executeActionOnProjection` performs an operation on the projection specified by `action`
* detach, destroy) * (insert, detach, destroy).
* *
* Inserting a projection requires us to locate the projected nodes from the parent component. The * Inserting a projection requires us to locate the projected nodes from the parent component. The
* complication is that those nodes themselves could be re-projected from their parent component. * complication is that those nodes themselves could be re-projected from their parent component.
@ -844,8 +844,8 @@ function executeActionOnContainer(
/** /**
* `executeActionOnElementContainer` performs an operation on the ng-container node and its child nodes * `executeActionOnElementContainer` performs an operation on the ng-container node and its child
* as specified by the `action` (insert, detach, destroy) * nodes as specified by the `action` (insert, detach, destroy).
* *
* @param renderer Renderer to use * @param renderer Renderer to use
* @param action action to perform (insert, detach, destroy) * @param action action to perform (insert, detach, destroy)

View File

@ -279,68 +279,68 @@ describe('Zone', function() {
// TODO: JiaLiPassion, need to find out why the test bundle is not `use strict`. // TODO: JiaLiPassion, need to find out why the test bundle is not `use strict`.
xit('event handler with null context should use event.target', xit('event handler with null context should use event.target',
ifEnvSupports(canPatchOnProperty(Document.prototype, 'onmousedown'), function() { ifEnvSupports(canPatchOnProperty(Document.prototype, 'onmousedown'), function() {
const ieVer = getIEVersion(); const ieVer = getIEVersion();
if (ieVer && ieVer === 9) { if (ieVer && ieVer === 9) {
// in ie9, this is window object even we call func.apply(undefined) // in ie9, this is window object even we call func.apply(undefined)
return; return;
} }
const logs: string[] = []; const logs: string[] = [];
const EventTarget = (window as any)['EventTarget']; const EventTarget = (window as any)['EventTarget'];
let oriAddEventListener = EventTarget && EventTarget.prototype ? let oriAddEventListener = EventTarget && EventTarget.prototype ?
(EventTarget.prototype as any)[zoneSymbol('addEventListener')] : (EventTarget.prototype as any)[zoneSymbol('addEventListener')] :
(HTMLSpanElement.prototype as any)[zoneSymbol('addEventListener')]; (HTMLSpanElement.prototype as any)[zoneSymbol('addEventListener')];
if (!oriAddEventListener) { if (!oriAddEventListener) {
// no patched addEventListener found // no patched addEventListener found
return; return;
} }
let handler1: Function; let handler1: Function;
let handler2: Function; let handler2: Function;
const listener = function() { logs.push('listener1'); }; const listener = function() { logs.push('listener1'); };
const listener1 = function() { logs.push('listener2'); }; const listener1 = function() { logs.push('listener2'); };
HTMLSpanElement.prototype.addEventListener = function( HTMLSpanElement.prototype.addEventListener = function(
eventName: string, callback: any) { eventName: string, callback: any) {
if (eventName === 'click') { if (eventName === 'click') {
handler1 = callback; handler1 = callback;
} else if (eventName === 'mousedown') { } else if (eventName === 'mousedown') {
handler2 = callback; handler2 = callback;
} }
return oriAddEventListener.apply(this, arguments); return oriAddEventListener.apply(this, arguments);
}; };
(HTMLSpanElement.prototype as any)[zoneSymbol('addEventListener')] = null; (HTMLSpanElement.prototype as any)[zoneSymbol('addEventListener')] = null;
patchEventTarget(window, [HTMLSpanElement.prototype]); patchEventTarget(window, [HTMLSpanElement.prototype]);
const span = document.createElement('span'); const span = document.createElement('span');
document.body.appendChild(span); document.body.appendChild(span);
zone.run(function() { zone.run(function() {
span.addEventListener('click', listener); span.addEventListener('click', listener);
span.onmousedown = listener1; span.onmousedown = listener1;
}); });
expect(handler1 !).toBe(handler2 !); expect(handler1 !).toBe(handler2 !);
handler1 !.apply(null, [{type: 'click', target: span}]); handler1 !.apply(null, [{type: 'click', target: span}]);
handler2 !.apply(null, [{type: 'mousedown', target: span}]); handler2 !.apply(null, [{type: 'mousedown', target: span}]);
expect(hookSpy).toHaveBeenCalled(); expect(hookSpy).toHaveBeenCalled();
expect(logs).toEqual(['listener1', 'listener2']); expect(logs).toEqual(['listener1', 'listener2']);
document.body.removeChild(span); document.body.removeChild(span);
if (EventTarget) { if (EventTarget) {
(EventTarget.prototype as any)[zoneSymbol('addEventListener')] = (EventTarget.prototype as any)[zoneSymbol('addEventListener')] =
oriAddEventListener; oriAddEventListener;
} else { } else {
(HTMLSpanElement.prototype as any)[zoneSymbol('addEventListener')] = (HTMLSpanElement.prototype as any)[zoneSymbol('addEventListener')] =
oriAddEventListener; oriAddEventListener;
} }
})); }));
it('SVGElement onclick should be in zone', it('SVGElement onclick should be in zone',
ifEnvSupports( ifEnvSupports(