CLN: simplify Styler clear mechanics and tests
- [x] follows #42187 
- [x] checks an item off #40675

The current mechanics are unstructured and the tests is not future proof (if new attributes are added tests will not pick these up and fail). This PR generalises the construction and future proofs the tests. No user facing change.

sure