1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16exports.source = ` 17@Entry 18@Component 19struct MyComponent { 20 build() { 21 Column() { 22 ForEach( 23 weekNames, 24 (item: string, index: number) => { 25 Text(item).fontSize(10) 26 ForEach( 27 weekNames, 28 (item: string, index: number) => { 29 Text(item).fontSize(10) 30 Column() { 31 Text(item).fontSize(10) 32 } 33 }, 34 (item: any, index: number) => item 35 ) 36 }, 37 (item: any, index: number) => item 38 ) 39 } 40 } 41}` 42 43exports.expectResult = 44`"use strict"; 45class MyComponent extends View { 46 constructor(compilerAssignedUniqueChildId, parent, params) { 47 super(compilerAssignedUniqueChildId, parent); 48 this.updateWithValueParams(params); 49 } 50 updateWithValueParams(params) { 51 } 52 aboutToBeDeleted() { 53 SubscriberManager.Get().delete(this.id()); 54 } 55 render() { 56 Column.create(); 57 ForEach.create("3", this, ObservedObject.GetRawObject(weekNames), (item, index) => { 58 Text.create(item); 59 Text.fontSize(10); 60 Text.pop(); 61 ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { 62 Text.create(item); 63 Text.fontSize(10); 64 Text.pop(); 65 Column.create(); 66 Text.create(item); 67 Text.fontSize(10); 68 Text.pop(); 69 Column.pop(); 70 }, (item, index) => item); 71 ForEach.pop(); 72 }, (item, index) => item); 73 ForEach.pop(); 74 Column.pop(); 75 } 76} 77loadDocument(new MyComponent("1", undefined, {})); 78` 79