St Sanderson, Arinda, Stephen discussed on The 6 Figure Developer Podcast


Something of a reasonable quality. Okay so you. So you just mentioned that you can after borrowing some code from st sanderson and mixing that with the giardi had you can Test the markup is generated from a component. How do you set that up. How do you actually get it to where you can use the component in the test. That's a really good question. So the first thing. I try begging way back whilst just to see if i if i knew my component and try to chest institute like you would in a regular unit test. That doesn't really work. You quickly realize because the news doesn't actually know how to produce output like stephen and the team. There have made a really good decision about having teens. Raisins of concerns between what a component is and what the fingers that renders the component and. So what you need to be able to actually verify. All lanes baked the mockup that a component producers that you need something that can take the component you want to and render it and then hand you back what else created and this is sort of what what bid unit encapsulates in in the context that you can ask to rent a component and you can pass it parameters and what you get. Back is an abstraction. I called arinda component. That object contains the instance off the component. You asked to be rented but it also contains the role model that the component producers but inside of that we use angle shop which is a shout based library with html and it's actually Competing of huma five spec so i passed role model. We get from from from from from from basically the data shaver runtime which i'm using in the vagrant bucs twinkle shop and then it passes of that and then we have Just the same guys. We have in the browser to query the generated which has represented in estan notes shop. So you can use your cruiser dick to all an in glaze. Actually i have sought options short hands for that. I have find find all niffer that takes us next so you can go in and in very it feels like it doesn't feel like i guess you i- testing in innocent kind of way like you have to set a lot of things up and you have to actually run that the abdication in a in a full instance and you have browser. You're automating. maybe it's hit up but it's still being automated. It's just one and completely shop and everything you winning and components shop and then you get the output and you can carry that through the english. Api so that's that's i guess that's actually the the quite long answer to your question all right. So you said that that You can use the corey selector. All and stuff are you using the same J. query style syntax for the Selecting the element is like a hash And then the idea of the thing and then dot for class and all that stuff. it's just so i'm just redirecting and doing a little bit of extra stuff. I'm redirecting to angle shop. An angle shop has the croatian extra enclosure leaked all our script while not as nc shop. But it's i mean once you have the browser and they just take a selector input like we did does still exist. I guess so. So yeah it. It's very intuitive to work with And you can sort of say while. I want to like the classic example That that is my default one to show just what you can do with beauty to. Everybody have done the final budget place. And you get a.

Coming up next