Skip to content

Commit

Permalink
tests: add test for custom component param in 'createCompoent'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishieck committed Jun 22, 2021
1 parent be7fa30 commit e955599
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
25 changes: 25 additions & 0 deletions tests/functionality/custom-component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { createComponent, Component } from "/src/main.js";
import logResult from "/tests/functionality/log-result.js";

class CustomComponent extends Component {
constructor() {
super();
}

customMethod() {
return true;
}
}

const _CustomComponent = async () => {
const markup = /* html */ `
<div></div>
`;

const customComponent = await createComponent({ markup }, CustomComponent);
const passed = customComponent.scope.tagName === "DIV" && customComponent.customMethod();
logResult(passed);
return customComponent;
};

export default _CustomComponent;
4 changes: 4 additions & 0 deletions tests/functionality/functionality.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import conditionals from "./conditionals/conditionals.js";
import utils from "./utils/utils.js";
import attributes from "./attributes/attributes.js";
import middleware from "./middleware/middleware.js";
import CustomComponent from "./custom-component.js";

// Tests for the API
// createComponent
Expand Down Expand Up @@ -104,3 +105,6 @@ import middleware from "./middleware/middleware.js";
// middleware.styles.custom();
// middleware.styles.postprocessor();
// middleware.styles.preprocessor();

// Test for Custom Component
CustomComponent();
27 changes: 0 additions & 27 deletions tests/functionality/index.htm

This file was deleted.

0 comments on commit e955599

Please sign in to comment.