Skip to content

Commit

Permalink
angulardart-community#7 fixing formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorBabalich committed Jun 9, 2022
1 parent 597fc01 commit 112aa40
Show file tree
Hide file tree
Showing 87 changed files with 1,037 additions and 611 deletions.
41 changes: 27 additions & 14 deletions _tests/test/common/directives/for_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ void main() {
});

test('should iterate over an array of objects', () async {
var testBed = NgTestBed<NgForOptionsTest>(ng.createNgForOptionsTestFactory());
var testBed =
NgTestBed<NgForOptionsTest>(ng.createNgForOptionsTestFactory());
var testFixture = await testBed.create();
await testFixture.update((NgForOptionsTest component) {
component.items = [
Expand Down Expand Up @@ -134,15 +135,17 @@ void main() {

test('should throw on non-iterable ref and suggest using an array',
() async {
final testBed = NgTestBed<NgForOptionsTest>(ng.createNgForOptionsTestFactory());
final testBed =
NgTestBed<NgForOptionsTest>(ng.createNgForOptionsTestFactory());
final testFixture = await testBed.create();
expect(testFixture.update((component) {
component.items = 'this is not iterable';
}), throwsA(const TypeMatcher<TypeError>()));
});

test('should work with duplicates', () async {
var testBed = NgTestBed<NgForObjectItemInstanceTest>(ng.createNgForObjectItemInstanceTestFactory());
var testBed = NgTestBed<NgForObjectItemInstanceTest>(
ng.createNgForObjectItemInstanceTestFactory());
var testFixture = await testBed.create();
await testFixture.update((NgForObjectItemInstanceTest component) {
var a = Foo('titleA');
Expand All @@ -152,7 +155,8 @@ void main() {
});

test('should repeat over nested arrays', () async {
var testBed = NgTestBed<NgForNestedTest>(ng.createNgForNestedTestFactory());
var testBed =
NgTestBed<NgForNestedTest>(ng.createNgForNestedTestFactory());
var testFixture = await testBed.create();
await testFixture.update((NgForNestedTest component) {
component.items = [
Expand All @@ -173,7 +177,8 @@ void main() {
test(
'should repeat over nested arrays with no intermediate '
'element', () async {
var testBed = NgTestBed<NgForNestedTemplateTest>(ng.createNgForNestedTemplateTestFactory());
var testBed = NgTestBed<NgForNestedTemplateTest>(
ng.createNgForNestedTemplateTestFactory());
var testFixture = await testBed.create();
await testFixture.update((NgForNestedTemplateTest component) {
component.items = [
Expand All @@ -194,7 +199,8 @@ void main() {
test(
'should repeat over nested ngIf that are the last node in '
'the ngFor temlate', () async {
var testBed = NgTestBed<NgForNestedLastIfTest>(ng.createNgForNestedLastIfTestFactory());
var testBed = NgTestBed<NgForNestedLastIfTest>(
ng.createNgForNestedLastIfTestFactory());
var testFixture = await testBed.create();
var el = testFixture.rootElement;
await testFixture.update((NgForNestedLastIfTest component) {
Expand Down Expand Up @@ -227,7 +233,9 @@ void main() {
});

test('should ignore extra spaces after a let assignment', () async {
final fixture = await NgTestBed<LetAssignmentSpacingTest>(ng.createLetAssignmentSpacingTestFactory()).create();
final fixture = await NgTestBed<LetAssignmentSpacingTest>(
ng.createLetAssignmentSpacingTestFactory())
.create();
expect(fixture.text, '012');
});

Expand Down Expand Up @@ -284,7 +292,8 @@ void main() {
});

test('should allow using a custom template', () async {
var testBed = NgTestBed<NgForCustomTemplateTest>(ng.createNgForCustomTemplateTestFactory());
var testBed = NgTestBed<NgForCustomTemplateTest>(
ng.createNgForCustomTemplateTestFactory());
var testFixture = await testBed.create();
await testFixture.update((component) {
component.child!.items = ['a', 'b', 'c'];
Expand All @@ -293,7 +302,8 @@ void main() {
});

test('should use a default template if a custom one is null', () async {
var testBed = NgTestBed<NgForCustomTemplateNullTest>(ng.createNgForCustomTemplateNullTestFactory());
var testBed = NgTestBed<NgForCustomTemplateNullTest>(
ng.createNgForCustomTemplateNullTestFactory());
var testFixture = await testBed.create();
await testFixture.update((NgForCustomTemplateNullTest component) {
component.child!.items = ['a', 'b', 'c'];
Expand All @@ -304,8 +314,8 @@ void main() {
test(
'should use a custom template (precedence) when both default and a '
'custom one are present', () async {
var testBed =
NgTestBed<NgForCustomTemplatePrecedenceTest>(ng.createNgForCustomTemplatePrecedenceTestFactory());
var testBed = NgTestBed<NgForCustomTemplatePrecedenceTest>(
ng.createNgForCustomTemplatePrecedenceTestFactory());
var testFixture = await testBed.create();
await testFixture.update((NgForCustomTemplatePrecedenceTest component) {
component.child!.items = ['a', 'b', 'c'];
Expand Down Expand Up @@ -377,7 +387,8 @@ void main() {
test(
'should handle added and removed items properly when tracking '
'by index', () async {
var testBed = NgTestBed<TrackByIndexTest>(ng.createTrackByIndexTestFactory());
var testBed =
NgTestBed<TrackByIndexTest>(ng.createTrackByIndexTestFactory());
var testFixture = await testBed.create();
await testFixture.update((TrackByIndexTest component) {
component.items = ['a', 'b', 'c', 'd'];
Expand All @@ -394,7 +405,8 @@ void main() {
test(
'should remove by index when list item or '
'it\'s hash changes', () async {
var testBed = NgTestBed<ObjectEditorComponent>(ng.createObjectEditorComponentFactory());
var testBed = NgTestBed<ObjectEditorComponent>(
ng.createObjectEditorComponentFactory());
var testFixture = await testBed.create();
await testFixture.update((ObjectEditorComponent component) {
component.entities = ['a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1'];
Expand All @@ -417,7 +429,8 @@ void main() {
test(
'should remove item if hash code is changed before '
'removing element from list', () async {
var testBed = NgTestBed<NgForHashcodeTest>(ng.createNgForHashcodeTestFactory());
var testBed =
NgTestBed<NgForHashcodeTest>(ng.createNgForHashcodeTestFactory());
var testFixture = await testBed.create();
var testItems = [
HashcodeTestItem(1),
Expand Down
16 changes: 10 additions & 6 deletions _tests/test/common/directives/if_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ void main() {
tearDown(() => disposeAnyRunningTest());

test('should work in a template element', () async {
var testBed = NgTestBed<NgIfInTemplateComponent>(ng.createNgIfInTemplateComponentFactory());
var testBed = NgTestBed<NgIfInTemplateComponent>(
ng.createNgIfInTemplateComponentFactory());
var testFixture = await testBed.create();
var element = testFixture.rootElement;
expect(element.querySelectorAll('copy-me'), hasLength(1));
expect(element.innerHtml, contains('hello2'));
});

test('should toggle node when condition changes', () async {
var testBed = NgTestBed<NgIfToggleTestComponent>(ng.createNgIfToggleTestComponentFactory());
var testBed = NgTestBed<NgIfToggleTestComponent>(
ng.createNgIfToggleTestComponentFactory());
var testFixture = await testBed.create();
var element = testFixture.rootElement;

Expand All @@ -39,7 +41,8 @@ void main() {
});

test('should handle nested if correctly', () async {
var testBed = NgTestBed<NgIfNestedTestComponent>(ng.createNgIfNestedTestComponentFactory());
var testBed = NgTestBed<NgIfNestedTestComponent>(
ng.createNgIfNestedTestComponentFactory());
var testFixture = await testBed.create();
var element = testFixture.rootElement;

Expand Down Expand Up @@ -75,7 +78,8 @@ void main() {
});

test('should update multiple bindings', () async {
var testBed = NgTestBed<NgIfMultiUpdateTestComponent>(ng.createNgIfMultiUpdateTestComponentFactory());
var testBed = NgTestBed<NgIfMultiUpdateTestComponent>(
ng.createNgIfMultiUpdateTestComponentFactory());
var testFixture = await testBed.create();
var element = testFixture.rootElement;
// Check startup.
Expand All @@ -100,8 +104,8 @@ void main() {
});

test('should throw during change detection if getter changes', () async {
var testBed =
NgTestBed<NgIfThrowsDuringChangeDetection>(ng.createNgIfThrowsDuringChangeDetectionFactory());
var testBed = NgTestBed<NgIfThrowsDuringChangeDetection>(
ng.createNgIfThrowsDuringChangeDetectionFactory());
var fixture = await testBed.create();
expect(
fixture.update((c) => c.startFailing = true),
Expand Down
52 changes: 32 additions & 20 deletions _tests/test/common/directives/ng_class_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ void main() {

group('ngClass', () {
test('should clean up when the directive is destroyed', () async {
var testBed = NgTestBed<DestroyClassTest>(ng.createDestroyClassTestFactory());
var testBed =
NgTestBed<DestroyClassTest>(ng.createDestroyClassTestFactory());
var testFixture = await testBed.create();
await testFixture.update((DestroyClassTest component) {
component.items = [
Expand Down Expand Up @@ -40,7 +41,8 @@ void main() {
});

test('should update classes based on changes in map values', () async {
var testBed = NgTestBed<ConditionMapTest>(ng.createConditionMapTestFactory());
var testBed =
NgTestBed<ConditionMapTest>(ng.createConditionMapTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo']));
Expand Down Expand Up @@ -156,7 +158,8 @@ void main() {

test('should take initial classes into account when a reference changes',
() async {
var testBed = NgTestBed<ListUpdateWithInitialTest>(ng.createListUpdateWithInitialTestFactory());
var testBed = NgTestBed<ListUpdateWithInitialTest>(
ng.createListUpdateWithInitialTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo']));
Expand All @@ -167,7 +170,8 @@ void main() {
});

test('should ignore empty or blank class names', () async {
var testBed = NgTestBed<ListUpdateWithInitialTest>(ng.createListUpdateWithInitialTestFactory());
var testBed = NgTestBed<ListUpdateWithInitialTest>(
ng.createListUpdateWithInitialTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((ListUpdateWithInitialTest component) {
Expand All @@ -177,7 +181,8 @@ void main() {
});

test('should trim blanks from class names', () async {
var testBed = NgTestBed<ListUpdateWithInitialTest>(ng.createListUpdateWithInitialTestFactory());
var testBed = NgTestBed<ListUpdateWithInitialTest>(
ng.createListUpdateWithInitialTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((ListUpdateWithInitialTest component) {
Expand Down Expand Up @@ -220,14 +225,16 @@ void main() {
});

test('should add classes specified in a string literal', () async {
var testBed = NgTestBed<StringLiteralTest>(ng.createStringLiteralTestFactory());
var testBed =
NgTestBed<StringLiteralTest>(ng.createStringLiteralTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo', 'bar', 'foo-bar', 'fooBar']));
});

test('should update classes based on changes to the string', () async {
var testBed = NgTestBed<StringUpdateTest>(ng.createStringUpdateTestFactory());
var testBed =
NgTestBed<StringUpdateTest>(ng.createStringUpdateTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo']));
Expand All @@ -243,7 +250,8 @@ void main() {

test('should remove active classes when switching from string to null',
() async {
var testBed = NgTestBed<StringUpdateTest>(ng.createStringUpdateTestFactory());
var testBed =
NgTestBed<StringUpdateTest>(ng.createStringUpdateTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo']));
Expand All @@ -256,7 +264,8 @@ void main() {
test(
'should take initial classes into account when '
'switching from string to null', () async {
var testBed = NgTestBed<StringUpdateWithInitialTest>(ng.createStringUpdateWithInitialTestFactory());
var testBed = NgTestBed<StringUpdateWithInitialTest>(
ng.createStringUpdateWithInitialTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo']));
Expand All @@ -267,7 +276,8 @@ void main() {
});

test('should ignore empty and blank strings', () async {
var testBed = NgTestBed<StringUpdateWithInitialTest>(ng.createStringUpdateWithInitialTestFactory());
var testBed = NgTestBed<StringUpdateWithInitialTest>(
ng.createStringUpdateWithInitialTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((StringUpdateWithInitialTest component) {
Expand All @@ -277,7 +287,8 @@ void main() {
});

test('should cooperate with the class attribute', () async {
var testBed = NgTestBed<MapUpdateWithInitialTest>(ng.createMapUpdateWithInitialTestFactory());
var testBed = NgTestBed<MapUpdateWithInitialTest>(
ng.createMapUpdateWithInitialTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((MapUpdateWithInitialTest component) {
Expand All @@ -295,8 +306,8 @@ void main() {
});

test('should cooperate with interpolated class attribute', () async {
var testBed =
NgTestBed<MapUpdateWithInitialInterpolationTest>(ng.createMapUpdateWithInitialInterpolationTestFactory());
var testBed = NgTestBed<MapUpdateWithInitialInterpolationTest>(
ng.createMapUpdateWithInitialInterpolationTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture
Expand All @@ -317,8 +328,8 @@ void main() {
});

test('should cooperate with class attribute and binding to it', () async {
var testBed =
NgTestBed<MapUpdateWithInitialBindingTest>(ng.createMapUpdateWithInitialBindingTestFactory());
var testBed = NgTestBed<MapUpdateWithInitialBindingTest>(
ng.createMapUpdateWithInitialBindingTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((MapUpdateWithInitialBindingTest component) {
Expand All @@ -337,8 +348,8 @@ void main() {

test('should cooperate with class attribute and class.name binding',
() async {
var testBed =
NgTestBed<MapUpdateWithConditionBindingTest>(ng.createMapUpdateWithConditionBindingTestFactory());
var testBed = NgTestBed<MapUpdateWithConditionBindingTest>(
ng.createMapUpdateWithConditionBindingTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['init', 'foo', 'baz']));
Expand All @@ -359,7 +370,8 @@ void main() {
test(
'should cooperate with initial class and class '
'attribute binding when binding changes', () async {
var testBed = NgTestBed<MapUpdateWithStringBindingTest>(ng.createMapUpdateWithStringBindingTestFactory());
var testBed = NgTestBed<MapUpdateWithStringBindingTest>(
ng.createMapUpdateWithStringBindingTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['init', 'foo']));
Expand All @@ -380,8 +392,8 @@ void main() {
test(
'should cooperate with interpolated class attribute '
'and clas.name binding', () async {
var testBed =
NgTestBed<InterpolationWithConditionBindingTest>(ng.createInterpolationWithConditionBindingTestFactory());
var testBed = NgTestBed<InterpolationWithConditionBindingTest>(
ng.createInterpolationWithConditionBindingTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
expect(content.classes, equals(['foo', 'baz']));
Expand Down
6 changes: 4 additions & 2 deletions _tests/test/common/directives/ng_style_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ void main() {
});

test('should cooperate with the style attribute', () async {
var testBed = NgTestBed<MapUpdateWithDefaultTest>(ng.createMapUpdateWithDefaultTestFactory());
var testBed = NgTestBed<MapUpdateWithDefaultTest>(
ng.createMapUpdateWithDefaultTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((MapUpdateWithDefaultTest component) {
Expand All @@ -54,7 +55,8 @@ void main() {

test('should cooperate with the style.[styleName]="expr" special-case',
() async {
var testBed = NgTestBed<MapUpdateWithStyleExprTest>(ng.createMapUpdateWithStyleExprTestFactory());
var testBed = NgTestBed<MapUpdateWithStyleExprTest>(
ng.createMapUpdateWithStyleExprTestFactory());
var testFixture = await testBed.create();
var content = testFixture.rootElement.querySelector('div')!;
await testFixture.update((MapUpdateWithStyleExprTest component) {
Expand Down
Loading

0 comments on commit 112aa40

Please sign in to comment.