browser_net_cyrillic-02.js (2275B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Tests if cyrillic text is rendered correctly in the source editor 8 * when loaded directly from an HTML page. 9 */ 10 11 add_task(async function () { 12 const { monitor } = await initNetMonitor(CYRILLIC_URL, { 13 requestCount: 1, 14 }); 15 info("Starting test... "); 16 17 const { document, store, windowRequire } = monitor.panelWin; 18 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); 19 const { getDisplayedRequests, getSortedRequests } = windowRequire( 20 "devtools/client/netmonitor/src/selectors/index" 21 ); 22 23 store.dispatch(Actions.batchEnable(false)); 24 25 let wait = waitForNetworkEvents(monitor, 1); 26 await reloadBrowser(); 27 await wait; 28 29 const requestItem = document.querySelectorAll(".request-list-item")[0]; 30 const requestsListStatus = requestItem.querySelector(".status-code"); 31 requestItem.scrollIntoView(); 32 EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); 33 await waitUntil(() => requestsListStatus.title); 34 await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); 35 36 await verifyRequestItemTarget( 37 document, 38 getDisplayedRequests(store.getState()), 39 getSortedRequests(store.getState())[0], 40 "GET", 41 CYRILLIC_URL, 42 { 43 status: 200, 44 statusText: "OK", 45 } 46 ); 47 48 wait = waitForDOM(document, "#headers-panel"); 49 EventUtils.sendMouseEvent( 50 { type: "mousedown" }, 51 document.querySelectorAll(".request-list-item")[0] 52 ); 53 await wait; 54 55 wait = waitForDOM(document, "#response-panel .data-header"); 56 clickOnSidebarTab(document, "response"); 57 await wait; 58 59 wait = waitForDOM(document, "#response-panel .cm-content"); 60 const header = document.querySelector( 61 "#response-panel .raw-data-toggle-input .devtools-checkbox-toggle" 62 ); 63 clickElement(header, monitor); 64 await wait; 65 66 // CodeMirror will only load lines currently in view to the DOM. getValue() 67 // retrieves all lines pending render after a user begins scrolling. 68 const text = getCodeMirrorValue(monitor); 69 70 ok( 71 text.includes("\u0411\u0440\u0430\u0442\u0430\u043d"), 72 "The text shown in the source editor is correct." 73 ); 74 75 return teardown(monitor); 76 });