Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh committed Dec 13, 2024
1 parent 6da62fe commit 5aafa40
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
31 changes: 14 additions & 17 deletions crates/csslsrs/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,26 @@ impl LanguageService {
/// use csslsrs::service::{LanguageService, LanguageServiceOptions};
/// use csslsrs::css_data::CssCustomData;
/// use csslsrs::converters::PositionEncoding;
/// use csslsrs::css_data::{CssSection, AtDirectives, PseudoClasses, PseudoElements, Properties, PropertyEntry, PropertyAttributes};
/// use csslsrs::css_data::{PropertyEntry};
///
/// let mut language_service = LanguageService::new(LanguageServiceOptions::default());
///
/// let custom_data = CssCustomData {
/// css: CssSection {
/// at_directives: AtDirectives { entry: vec![] },
/// pseudo_classes: PseudoClasses { entry: vec![] },
/// pseudo_elements: PseudoElements { entry: vec![] },
/// properties: Properties { entry: vec![
/// at_directives: vec![],
/// pseudo_classes: vec![],
/// pseudo_elements: vec![],
/// properties: vec![
/// PropertyEntry {
/// attributes: PropertyAttributes {
/// name: "my-custom-property".to_string(),
/// restriction: None,
/// version: None,
/// browsers: None,
/// ref_: None,
/// syntax: None,
/// },
/// desc: None,
/// name: "my-custom-property".to_string(),
/// restrictions: None,
/// browsers: None,
/// references: None,
/// at_rule: None,
/// relevance: None,
/// syntax: None,
/// description: None,
/// }
/// ] }
/// }
/// ]
/// };
///
/// language_service.add_css_custom_data(custom_data);
Expand Down
14 changes: 6 additions & 8 deletions crates/csslsrs/tests/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ fn test_hover_over_color_property_inline() {
let expected_hover = Hover {
contents: HoverContents::Markup(MarkupContent {
kind: MarkupKind::Markdown,
value: "**color**\n\nSets the color of an element's text\n\n**Syntax**: `body { $(name): red; }`\n\n**Restriction**: color\n\n**Supported Browsers**:\n- all\n\n**Reference**:\n- [color](http://www.w3.org/TR/css3-color/#foreground)\n\n".to_string(),
value: "**color**\n\nSets the color of an element's text\n\n**Syntax**: `<color>`\n\n**Restriction**:\n- color\n**Supported Browsers**:\n- E12\n- FF1\n- S1\n- C1\n- IE3\n- O3.5\n\n**Reference**:\n- [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color)\n\n".to_owned()
}),
range: Some(Range {
start: Position { line: 0, character: 8 },
end: Position { line: 0, character: 13 },
}),
};
end: Position { line: 0, character: 13 }
}) };

assert_hover(css_text, expected_hover);
}
Expand All @@ -80,13 +79,12 @@ fn test_hover_over_color_property() {
let expected_hover = Hover {
contents: HoverContents::Markup(MarkupContent {
kind: MarkupKind::Markdown,
value: "**color**\n\nSets the color of an element's text\n\n**Syntax**: `body { $(name): red; }`\n\n**Restriction**: color\n\n**Supported Browsers**:\n- all\n\n**Reference**:\n- [color](http://www.w3.org/TR/css3-color/#foreground)\n\n".to_string(),
value: "**color**\n\nSets the color of an element's text\n\n**Syntax**: `<color>`\n\n**Restriction**:\n- color\n**Supported Browsers**:\n- E12\n- FF1\n- S1\n- C1\n- IE3\n- O3.5\n\n**Reference**:\n- [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color)\n\n".to_owned()
}),
range: Some(Range {
start: Position { line: 1, character: 2 },
end: Position { line: 1, character: 7 },
}),
};
end: Position { line: 1, character: 7 }
}) };

assert_hover(css_text, expected_hover);
}
Expand Down

0 comments on commit 5aafa40

Please sign in to comment.