Skip to content

Commit

Permalink
adding foundation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasrice committed Oct 7, 2020
1 parent 740322b commit 4dc35ff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ describe("FASTFoundation", () => {
console.log(element.$fastController.template, template);
await disconnect();
});

xit("the template resolved from $fastProvider when a local template property is not set", async () => {});
});

describe("should style with", () => {
Expand All @@ -78,5 +80,17 @@ describe("FASTFoundation", () => {
console.log(element.$fastController.styles, styles);
await disconnect();
});

xit("the styles resolved from $fastProvider when a local template property is not set", async () => {});
});

it("should resolve a null $fastProvider if no parent FASTProvider exists", async () => {
const { element, connect, disconnect } = await setup("bare-element");
await connect();

expect(element.$fastProvider).to.equal(null);
await disconnect();
});

xit("should resolve a provider element to $fastProvider after DOM connection if element has a parent FASTProvider", async () => {});
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export abstract class FASTFoundation extends FASTElement {
*/
@observable
public template: ElementViewTemplate | void | null;
private templateChanged(): void {
protected templateChanged(): void {
if (this.template !== undefined) {
this.$fastController.template = this.template;
}
Expand All @@ -39,7 +39,7 @@ export abstract class FASTFoundation extends FASTElement {
*/
@observable
public styles: ElementStyles | void | null;
private stylesChanged(): void {
protected stylesChanged(): void {
if (this.styles !== undefined) {
this.$fastController.styles = this.styles;
}
Expand All @@ -59,7 +59,10 @@ export abstract class FASTFoundation extends FASTElement {
return this.$fastProvider?.resolveStylesFor(this) || null;
}

connectedCallback() {
/**
* Invoked when element is connected to the DOM.
*/
public connectedCallback() {
this.$fastProvider = FASTProvider.resolveProvider(this);
super.connectedCallback();
}
Expand Down

0 comments on commit 4dc35ff

Please sign in to comment.