orc-shared 5.10.0-dev.10 → 5.10.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +1 -1
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +3 -1
- package/package.json +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +1 -4
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +1 -1
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.test.js +1 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +4 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +27 -0
|
@@ -66,7 +66,7 @@ var MultipleLinesText = function MultipleLinesText(_ref) {
|
|
|
66
66
|
}
|
|
67
67
|
}, [isClamped, setIsClamped]);
|
|
68
68
|
return /*#__PURE__*/_react.default.createElement(TooltippedTextClamp, {
|
|
69
|
-
disableCssClamp:
|
|
69
|
+
disableCssClamp: false,
|
|
70
70
|
clamp: lineCount,
|
|
71
71
|
className: (0, _classnames.default)(classes.clampedText, customStyles),
|
|
72
72
|
children: children.toString(),
|
|
@@ -55,7 +55,9 @@ var withDeferredTooltip = function withDeferredTooltip(Comp) {
|
|
|
55
55
|
if (alwaysDisplay) {
|
|
56
56
|
setShouldBeTooltipped(true);
|
|
57
57
|
} else {
|
|
58
|
-
setShouldBeTooltipped(event.target.offsetWidth < event.target.scrollWidth
|
|
58
|
+
setShouldBeTooltipped(event.target.offsetWidth < event.target.scrollWidth ||
|
|
59
|
+
// for single line
|
|
60
|
+
event.target.scrollHeight > event.target.clientHeight); // for multiple lines
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
if (titleValue == null) return /*#__PURE__*/_react.default.createElement(Comp, props);
|
package/package.json
CHANGED
|
@@ -126,9 +126,6 @@ describe("Information Item", () => {
|
|
|
126
126
|
const label = "label";
|
|
127
127
|
const value = "value";
|
|
128
128
|
|
|
129
|
-
const multipleLinesTextProps = new TextProps();
|
|
130
|
-
multipleLinesTextProps.set(TextProps.propNames.lineCount, 2);
|
|
131
|
-
|
|
132
129
|
const component = (
|
|
133
130
|
<IntlProvider locale="en-US">
|
|
134
131
|
<InformationItem label={label} isMaxLineCountEnabled={null}>
|
|
@@ -140,7 +137,7 @@ describe("Information Item", () => {
|
|
|
140
137
|
const expected = (
|
|
141
138
|
<div>
|
|
142
139
|
<Typography children={label} />
|
|
143
|
-
<MultipleLinesText
|
|
140
|
+
<MultipleLinesText>{value}</MultipleLinesText>
|
|
144
141
|
</div>
|
|
145
142
|
);
|
|
146
143
|
|
|
@@ -41,7 +41,7 @@ const MultipleLinesText = ({ children, titleValue, textProps, tooltipClasses })
|
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
43
|
<TooltippedTextClamp
|
|
44
|
-
disableCssClamp={
|
|
44
|
+
disableCssClamp={false}
|
|
45
45
|
clamp={lineCount}
|
|
46
46
|
className={classNames(classes.clampedText, customStyles)}
|
|
47
47
|
children={children.toString()}
|
|
@@ -17,7 +17,10 @@ const withDeferredTooltip =
|
|
|
17
17
|
if (alwaysDisplay) {
|
|
18
18
|
setShouldBeTooltipped(true);
|
|
19
19
|
} else {
|
|
20
|
-
setShouldBeTooltipped(
|
|
20
|
+
setShouldBeTooltipped(
|
|
21
|
+
event.target.offsetWidth < event.target.scrollWidth || // for single line
|
|
22
|
+
event.target.scrollHeight > event.target.clientHeight,
|
|
23
|
+
); // for multiple lines
|
|
21
24
|
}
|
|
22
25
|
};
|
|
23
26
|
|
|
@@ -47,6 +47,33 @@ describe("withDeferredTooltip", () => {
|
|
|
47
47
|
expect(mountedTooltippedComponent.containsMatchingElement(expected), "to be true");
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
it("Wraps passed component in Mui tooltip if mouse enter event was triggered and scrollHeight is bigger than clientHeight", () => {
|
|
51
|
+
const Wrapper = props => <ComponentToBeTooltipped {...props} />;
|
|
52
|
+
|
|
53
|
+
const TooltippedCompponent = withDeferredTooltip(Wrapper);
|
|
54
|
+
|
|
55
|
+
const mountedTooltippedComponent = shallow(<TooltippedCompponent titleValue="test" />);
|
|
56
|
+
|
|
57
|
+
const event = {
|
|
58
|
+
target: {
|
|
59
|
+
offsetWidth: 0,
|
|
60
|
+
scrollWidth: 0,
|
|
61
|
+
scrollHeight: 200,
|
|
62
|
+
clientHeight: 100,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
mountedTooltippedComponent.find(Wrapper).invoke("onMouseEnter")(event);
|
|
67
|
+
|
|
68
|
+
let expected = (
|
|
69
|
+
<MuiTooltip>
|
|
70
|
+
<Wrapper />
|
|
71
|
+
</MuiTooltip>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
expect(mountedTooltippedComponent.containsMatchingElement(expected), "to be true");
|
|
75
|
+
});
|
|
76
|
+
|
|
50
77
|
it("Does not wrap passed component in Mui tooltip if scrollWidth is same as offsetWidth", () => {
|
|
51
78
|
const Wrapper = props => <ComponentToBeTooltipped {...props} />;
|
|
52
79
|
|