NSelene icon indicating copy to clipboard operation
NSelene copied to clipboard

Smoother API for users to extend NSelene conditions base with custom-user-defined conditions?

Open yashaka opened this issue 4 years ago • 1 comments

Look at this...

NSelene has its own conditions base, available at Be.*, Have.* (and probably after #49, also Be.Not.*, Have.No.*)...

Definitely at some point of time an average user can define their own conditions...

Question: How can we design/tune/change the NSelene API, so it will be easier for the end user to combine NSelene conditions usage with custom user defined conditions usage?

For example, write now Be.*, and Have.* a static classes... There is no way for the user to "extend" them...

If I would create my personal base of custom conditions, I will probably put them in my own static class, like: Match.*

then I can use

S("#foo").Should(Be.Enabled);
// and similarly, but with addition using statement:
S("#foo").Should(Match.Hightlighted);

Now comes our question... Should we change the implementation of Be.* from static class to the object of class Be so the user can extend it with its own custom conditions and be able to use?

S("#foo").Should(Be.Enabled);
S("#foo").Should(Be.Hightlighted);

yashaka avatar Jun 29 '20 16:06 yashaka

some cons that comes to the board – while having it as object - it will not be like that easier to automatically add using statements via Quick Fix support of some IDEs, for example, the VSCode does not support such Quick Fix...

yashaka avatar Jun 29 '20 16:06 yashaka