Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement HasStyle in LitTemplate so you can add class names to the root element (#10903) (CP: 2.7) #11017

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.littemplate.LitTemplateParser.LitTemplateParserFactory;
Expand Down Expand Up @@ -55,7 +56,7 @@
* @author Vaadin Ltd
* @since
*/
public abstract class LitTemplate extends Component {
public abstract class LitTemplate extends Component implements HasStyle {

static {
UsageStatistics.markAsUsed("flow/LitTemplate", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ public ElementWithTextLitTemplate(VaadinService service) {

}

// This is for checking LitTemplate implements HasStyle
@Tag("custom-element-with-class")
private static class ElementWithStyleClass extends LitTemplate {
ElementWithStyleClass() {
// Should be possible to modify the class name
addClassName("custom-element-class-name");
}
}

@Before
public void setUp() {
DeploymentConfiguration configuration = Mockito
Expand Down