@flighthq/textlayout 0.3.0 → 0.3.1-next.1041.35b950c
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/textlayout",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1-next.1041.35b950c",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/textshaper": "0.3.
|
|
42
|
-
"@flighthq/types": "0.3.
|
|
41
|
+
"@flighthq/textshaper": "0.3.1-next.1041.35b950c",
|
|
42
|
+
"@flighthq/types": "0.3.1-next.1041.35b950c"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.3.0"
|
|
@@ -24,7 +24,7 @@ function createData(data: Partial<RichTextData> = {}): RichTextData {
|
|
|
24
24
|
scrollV: 1,
|
|
25
25
|
selectable: true,
|
|
26
26
|
text: '',
|
|
27
|
-
textColor:
|
|
27
|
+
textColor: 0x000000ff,
|
|
28
28
|
textFormat: {},
|
|
29
29
|
textFormatRanges: [],
|
|
30
30
|
verticalAlign: 'top',
|
|
@@ -50,10 +50,10 @@ describe('clearRichTextContent', () => {
|
|
|
50
50
|
describe('computeRichTextContent', () => {
|
|
51
51
|
it('renders plain text under the base format', () => {
|
|
52
52
|
const content = createRichTextContent();
|
|
53
|
-
computeRichTextContent(content, createData({ text: 'hello', textColor:
|
|
53
|
+
computeRichTextContent(content, createData({ text: 'hello', textColor: 0x336699ff }));
|
|
54
54
|
expect(content.text).toBe('hello');
|
|
55
55
|
expect(content.formatRanges).toHaveLength(1);
|
|
56
|
-
expect(content.formatRanges[0].format.color).toBe(
|
|
56
|
+
expect(content.formatRanges[0].format.color).toBe(0x336699ff);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('decodes entities in plain text', () => {
|
|
@@ -109,11 +109,11 @@ describe('computeRichTextContent', () => {
|
|
|
109
109
|
content,
|
|
110
110
|
createData({
|
|
111
111
|
text: 'hello',
|
|
112
|
-
textColor:
|
|
113
|
-
textFormatRanges: [{ start: 1, end: 4, format: { color:
|
|
112
|
+
textColor: 0x000000ff,
|
|
113
|
+
textFormatRanges: [{ start: 1, end: 4, format: { color: 0xff0000ff } }],
|
|
114
114
|
}),
|
|
115
115
|
);
|
|
116
|
-
expect(content.formatRanges[1].format.color).toBe(
|
|
116
|
+
expect(content.formatRanges[1].format.color).toBe(0xff0000ff);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
|
package/src/textFormat.test.ts
CHANGED
|
@@ -48,8 +48,8 @@ describe('getTextFormatLeading', () => {
|
|
|
48
48
|
|
|
49
49
|
describe('mergeTextFormat', () => {
|
|
50
50
|
it('applies non-null override fields onto base', () => {
|
|
51
|
-
const result = mergeTextFormat({ size: 12, bold: false }, { bold: true, color:
|
|
52
|
-
expect(result).toMatchObject({ size: 12, bold: true, color:
|
|
51
|
+
const result = mergeTextFormat({ size: 12, bold: false }, { bold: true, color: 0xff0000ff });
|
|
52
|
+
expect(result).toMatchObject({ size: 12, bold: true, color: 0xff0000ff });
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('skips null and undefined override fields', () => {
|