Skip to content

Commit

Permalink
update non-mobile-friendly message (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
maliroteh-sf authored Jun 8, 2021
1 parent 415d85e commit 3a1fb46
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>com.salesforce.slds</groupId>
<artifactId>common</artifactId>
<version>0.0.10</version>
<version>0.0.11</version>
</parent>

<artifactId>core</artifactId>
<version>0.0.10</version>
<version>0.0.11</version>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
@Component
@Lazy
public class MobileFriendlyValidator implements RecommendationValidator, InitializingBean {
public static final String NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE =
" is known to have issues on mobile devices. Consider these options:\n" +
"• Find a mobile-ready replacement in the Component Reference of the Lightning Web Components Dev Guide. Filter the list using \"Salesforce Mobile App\" as the target.\n"+
"• Create a custom component that complies with \"Follow Accessible Mobile Design Guidelines\" in the Lightning Web Components Dev Guide.";

Map<String, List<String>> componentsRegistry;

@Override
Expand All @@ -53,9 +58,7 @@ public List<Recommendation> matches(Entry entry, Bundle bundle, Context context)

Action action = Action.builder()
.value(htmlElement.getContent().outerHtml()).range(htmlElement.getRange())
.description(tag
+ " is known to have issues on mobile devices. Consider using a replacement " +
"or create a custom component to use instead.")
.description(tag + NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE)
.name(tag)
.actionType(ActionType.NONE)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static com.salesforce.slds.validation.validators.impl.recommendation.MobileFriendlyValidator.NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE;

@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = SldsConfiguration.class)
Expand Down Expand Up @@ -74,9 +75,9 @@ void mobileComponentExperience1Parsing() throws IOException {
assertThat(results.get("lightning-flow-support"),
Matchers.hasItem(new Range(new Location(3, 4), new Location(3, 53))));
assertThat(messages.get("lightning-datatable"),
Matchers.equalTo("lightning-datatable is known to have issues on mobile devices. Consider using a replacement or create a custom component to use instead."));
Matchers.equalTo("lightning-datatable" + NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE));
assertThat(messages.get("lightning-flow-support"),
Matchers.equalTo("lightning-flow-support is known to have issues on mobile devices. Consider using a replacement or create a custom component to use instead."));
Matchers.equalTo("lightning-flow-support" + NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE));
}

@Test
Expand Down
6 changes: 3 additions & 3 deletions lsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>com.salesforce.slds</groupId>
<artifactId>common</artifactId>
<version>0.0.10</version>
<version>0.0.11</version>
</parent>

<artifactId>lsp</artifactId>
<version>0.0.10</version>
<version>0.0.11</version>

<dependencies>
<!-- Google Collection -->
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>com.salesforce.slds</groupId>
<artifactId>core</artifactId>
<version>0.0.10</version>
<version>0.0.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.lsp4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static com.salesforce.slds.validation.validators.impl.recommendation.MobileFriendlyValidator.NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE;

@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = ServerConfiguration.class)
Expand Down Expand Up @@ -187,7 +188,7 @@ void nonMobileFriendlyToken() {
List<DiagnosticResult> diagnosticResults = getDiagnosticResult(entry);
Range range = new Range(new Position(0,10), new Position(0, 53));
CodeAction action = getCodeAction(range, diagnosticResults);
assertAction(action, "lightning-datatable is known to have issues on mobile devices. Consider using a replacement or create a custom component to use instead.", "<lightning-datatable></lightning-datatable>");
assertAction(action, "lightning-datatable" + NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE, "<lightning-datatable></lightning-datatable>");
}

@Test
Expand All @@ -199,7 +200,7 @@ void nonMobileFriendlyKebabCaseToken() {
List<DiagnosticResult> diagnosticResults = getDiagnosticResult(entry);
Range range = new Range(new Position(0,10), new Position(0, 53));
CodeAction action = getCodeAction(range, diagnosticResults);
assertAction(action, "lightning-tree-grid is known to have issues on mobile devices. Consider using a replacement or create a custom component to use instead.", "<lightning-tree-grid></lightning-tree-grid>");
assertAction(action, "lightning-tree-grid" + NON_MOBILE_FRIENDLY_MESSAGE_TEMPLATE, "<lightning-tree-grid></lightning-tree-grid>");
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.salesforce.slds</groupId>
<artifactId>common</artifactId>
<packaging>pom</packaging>
<version>0.0.10</version>
<version>0.0.11</version>

<modules>
<module>core</module>
Expand Down

0 comments on commit 3a1fb46

Please sign in to comment.