I'm modeling a web page with a lot of items on it. Coming from a Ruby background, I had one class for each, say, large item and its subitems on the page. For instance, a navbar would be its own class:
import { Selector, t } from 'testcafe';
export class NavBar {
constructor () {
this.home = Selector('#home')
this.intro = Selector('#intro')
...
}
}
export class HeaderSection {
...
}
Questions:
- Do I need a default class? My IDE is complaining, but the test work. I believe, the answer is no, but it's a good practice(?)
- What's the recommended way to write a complex page model in JavaScript? I'm leaning to have one page class, say
indexand then have multiple child classes (NavbarandHeaderSectionon my example) that inherit from theindex class
Aucun commentaire:
Enregistrer un commentaire