mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 23:58:07 +02:00
Move the encodeToXmlString
helper function to src/core/core_utils.js
With the previous patch this function is now *only* accessed on the worker-thread, hence it's no longer necessary to include it in the *built* `pdf.js` file.
This commit is contained in:
parent
b66f294f64
commit
d366bbdf51
5 changed files with 62 additions and 64 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
import { Dict, Ref } from "../../src/core/primitives.js";
|
||||
import {
|
||||
encodeToXmlString,
|
||||
escapePDFName,
|
||||
getInheritableProperty,
|
||||
isWhiteSpace,
|
||||
|
@ -218,4 +219,18 @@ describe("core_utils", function () {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("encodeToXmlString", function () {
|
||||
it("should get a correctly encoded string with some entities", function () {
|
||||
const str = "\"\u0397ell😂' & <W😂rld>";
|
||||
expect(encodeToXmlString(str)).toEqual(
|
||||
""Ηell😂' & <W😂rld>"
|
||||
);
|
||||
});
|
||||
|
||||
it("should get a correctly encoded basic ascii string", function () {
|
||||
const str = "hello world";
|
||||
expect(encodeToXmlString(str)).toEqual(str);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
bytesToString,
|
||||
createPromiseCapability,
|
||||
createValidAbsoluteUrl,
|
||||
encodeToXmlString,
|
||||
escapeString,
|
||||
getModificationDate,
|
||||
isArrayBuffer,
|
||||
|
@ -335,20 +334,6 @@ describe("util", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("encodeToXmlString", function () {
|
||||
it("should get a correctly encoded string with some entities", function () {
|
||||
const str = "\"\u0397ell😂' & <W😂rld>";
|
||||
expect(encodeToXmlString(str)).toEqual(
|
||||
""Ηell😂' & <W😂rld>"
|
||||
);
|
||||
});
|
||||
|
||||
it("should get a correctly encoded basic ascii string", function () {
|
||||
const str = "hello world";
|
||||
expect(encodeToXmlString(str)).toEqual(str);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isAscii", function () {
|
||||
it("handles ascii/non-ascii strings", function () {
|
||||
expect(isAscii("hello world")).toEqual(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue