-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: should recognize negative preload value
- Loading branch information
Showing
5 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
packages/rspack-test-tools/tests/configCases/web/fetch-priority-2/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
it("should set fetchPriority", () => { | ||
import(/* webpackFetchPriority: "high" */ "./a"); | ||
expect(document.head.children).toHaveLength(3); | ||
const script1 = document.head.children[1]; | ||
expect(document.head.children).toHaveLength(4); | ||
const script1 = document.head.children[2]; | ||
expect(script1.getAttribute("fetchpriority")).toBe("high"); | ||
|
||
import(/* webpackFetchPriority: "low" */ "./b"); | ||
expect(document.head.children).toHaveLength(4); | ||
const script2 = document.head.children[3]; | ||
expect(document.head.children).toHaveLength(5); | ||
const script2 = document.head.children[4]; | ||
expect(script2.getAttribute("fetchpriority")).toBe("low"); | ||
|
||
import(/* webpackFetchPriority: "low" */ "./c"); | ||
expect(document.head.children).toHaveLength(5); | ||
const script3 = document.head.children[4]; | ||
expect(document.head.children).toHaveLength(6); | ||
const script3 = document.head.children[5]; | ||
expect(script3.getAttribute("fetchpriority")).toBe("low"); | ||
|
||
import(/* webpackPrefetch: 20, webpackFetchPriority: "auto" */ "./c"); | ||
|
||
import("./d") | ||
expect(document.head.children).toHaveLength(6); | ||
const script4 = document.head.children[5]; | ||
expect(document.head.children).toHaveLength(7); | ||
const script4 = document.head.children[6]; | ||
expect(script4.getAttribute("fetchpriority")).toBeFalsy(); | ||
|
||
import(/* webpackPrefetch: -20 */ "./d3"); | ||
expect(document.head.children).toHaveLength(7); | ||
const script5 = document.head.children[6]; | ||
expect(document.head.children).toHaveLength(8); | ||
const script5 = document.head.children[7]; | ||
expect(script5.getAttribute("fetchpriority")).toBeFalsy(); | ||
|
||
const condition = true; | ||
|
||
if (!condition) { | ||
import(/* webpackFetchPriority: "high", webpackChunkName: "one" */ "./e"); | ||
expect(document.head.children).toHaveLength(8); | ||
const script6 = document.head.children[7]; | ||
expect(document.head.children).toHaveLength(9); | ||
const script6 = document.head.children[8]; | ||
expect(script6.getAttribute("fetchpriority")).toBe("high"); | ||
} else { | ||
import(/* webpackFetchPriority: "low", webpackChunkName: "two" */ "./e"); | ||
expect(document.head.children).toHaveLength(8); | ||
const script6 = document.head.children[7]; | ||
expect(document.head.children).toHaveLength(9); | ||
const script6 = document.head.children[8]; | ||
expect(script6.getAttribute("fetchpriority")).toBe("low"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters