LCOV - code coverage report
Current view: top level - pkg/playground - index.js Coverage Total Hit
Test: cockpit Lines: 92.6 % 27 25
Test Date: 2026-07-17 07:33:01

            Line data    Source code
       1              : // SPDX-License-Identifier: LGPL-2.1-or-later
       2              : import '../lib/patternfly/patternfly-6-cockpit.scss';
       3              : import "../../node_modules/@patternfly/patternfly/components/Button/button.css";
       4              : import 'cockpit-dark-theme'; // once per page
       5            2 : import cockpit from "cockpit";
       6              : import { page_status } from "notifications";
       7              : 
       8              : import "../lib/page.scss";
       9              : 
      10            2 : function id(sel) {
      11            2 :     return document.getElementById(sel);
      12            2 : }
      13              : 
      14            2 : function init() {
      15            2 :     const entries = cockpit.manifests.playground.playground;
      16            2 :     cockpit.assert(typeof entries === "object", "Invalid playground manifest");
      17            2 :     const nav = id("nav");
      18              : 
      19            2 :     for (const p in entries) {
      20            2 :         const entry = entries[p];
      21            2 :         const li = document.createElement("li");
      22            2 :         const a = document.createElement("a");
      23            2 :         li.appendChild(a);
      24            0 :         a.appendChild(document.createTextNode(entry.label || p));
      25            0 :         a.onclick = () => { cockpit.jump("/playground/" + (entry.path || p)) };
      26            2 :         nav.appendChild(li);
      27            2 :     }
      28              : 
      29            1 :     id("set-status").onclick = event => {
      30            1 :         page_status.set_own({ type: id("type").value, title: id("title").value });
      31            1 :     };
      32              : 
      33            1 :     id("clear-status").onclick = event => {
      34            1 :         page_status.set_own(null);
      35            1 :     };
      36            2 : }
      37              : 
      38            2 : document.addEventListener("DOMContentLoaded", () => {
      39            2 :     cockpit.transport.wait(init);
      40            2 : });
        

Generated by: LCOV version 2.0-1