HTL data-sly-test

Avatar

Avatar
Validate 10
Level 2
ariellea4070516
Level 2

Likes

8 likes

Total Posts

39 posts

Correct reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
ariellea4070516
Level 2

Likes

8 likes

Total Posts

39 posts

Correct reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
ariellea4070516
Level 2

14-12-2018

Is there a way to test if listChildren will return anything? Something along the line of: <sly data-sly-test=${item.listChildren.size > 0} />

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

14-12-2018

Good question - here is more explanation on test -- htl-spec/SPECIFICATION.md at master · adobe/htl-spec · GitHub

See Section -- 2.2.5. Test

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,318 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,318 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

15-12-2018

Avatar

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Feike_Visser1
Employee

16-12-2018

You can call any method that has no arguments in data-sly-test.

In your case check if your item has these methods.

Avatar

Avatar
Validate 10
Level 2
ariellea4070516
Level 2

Likes

8 likes

Total Posts

39 posts

Correct reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
ariellea4070516
Level 2

Likes

8 likes

Total Posts

39 posts

Correct reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
ariellea4070516
Level 2

17-12-2018

Thank you all! Your answers pointed me to a solution. I was able to test whether or not the item had children this way:

<sly data-sly-test=${item.listChildren.hasNext} />