import {
  detectGt,
  detectOne
} from "./chunk-DJQTUDJM.js";
import {
  getRunPp
} from "./chunk-W55XSG6K.js";
import {
  require_tape
} from "./chunk-QWOE5YTB.js";
import "./chunk-74ZU4BT6.js";
import "./chunk-IW57W7EQ.js";
import "./chunk-ZTYNN6G5.js";
import "./chunk-DKVUOBIE.js";
import "./chunk-PRZWSBMA.js";
import "./chunk-LTOBEUM2.js";
import "./chunk-MKAF2BHB.js";
import "./chunk-WKNI3HRQ.js";
import "./chunk-VGYTAYFK.js";
import "./chunk-67DBIM6H.js";
import "./chunk-SA7APTJR.js";
import "./chunk-HJ6L54YS.js";
import "./chunk-LSEFWW72.js";
import "./chunk-SKREEF3H.js";
import "./chunk-HYOEWQ5P.js";
import "./chunk-HBW42TDT.js";
import "./chunk-G6O3URDN.js";
import "./chunk-FN5XPUPH.js";
import "./chunk-IIT367QZ.js";
import "./chunk-RZGEKL77.js";
import "./chunk-UI7OCM2A.js";
import "./chunk-YZK37YCC.js";
import "./chunk-7EMWHCVW.js";
import "./chunk-7IYJZZQI.js";
import "./chunk-M3J4MINX.js";
import "./chunk-PF4DSFDR.js";
import "./chunk-QH6W3NVF.js";
import "./chunk-NOEAT6CX.js";
import "./chunk-4UWS5Y3N.js";
import "./chunk-DD4R5P6W.js";
import "./chunk-JNITUVXP.js";
import "./chunk-KSGA62R2.js";
import "./chunk-LOZEKOES.js";
import "./chunk-TOU7EVFQ.js";
import "./chunk-OAWQ6LOO.js";
import "./chunk-TLT4YIG3.js";
import "./chunk-KYBIQBXE.js";
import {
  select_default
} from "./chunk-I6Y4O3RR.js";
import "./chunk-OMR2DT66.js";
import "./chunk-DQC5FFGV.js";
import {
  __toESM
} from "./chunk-HFNDKYVF.js";

// plots/gb/test/genomeBrowser.spec.js
var import_tape = __toESM(require_tape(), 1);
(0, import_tape.default)("\n", function(test) {
  test.comment("-***- plots/genomeBrowser -***-");
  test.end();
});
(0, import_tape.default)("sjlife default setting", (test) => {
  const holder = getHolder();
  runpp({
    holder,
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Sjlife default, with global mass filter", (test) => {
  const holder = getHolder();
  runpp({
    holder,
    state: {
      termfilter: {
        filter: {
          type: "tvslst",
          join: "and",
          in: true,
          lst: [
            {
              type: "tvs",
              tvs: {
                term: { id: "diaggrp_s" },
                values: [{ key: "Acute lymphoblastic leukemia", label: "Acute lymphoblastic leukemia" }]
              }
            },
            {
              type: "tvs",
              tvs: {
                term: { id: "agedx_s", name: "agedx", type: "float" },
                ranges: [{ startunbounded: true, stop: 10, stopinclusive: true }]
              }
            }
          ]
        }
      }
    },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Two groups: filter + population", (test) => {
  const holder = getHolder();
  const p = getPlot([groupFilterAML, groupPopulation1]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Two groups: filter + info", (test) => {
  const holder = getHolder();
  const p = getPlot([groupFilterAML, groupInfo1]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Two groups: filter + filter", (test) => {
  const holder = getHolder();
  const p = getPlot([groupFilterAML, groupFilterALLmale]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Two groups: info + info", (test) => {
  const holder = getHolder();
  const p = getPlot([groupInfo1, groupInfo2]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Two groups: info + poulation", (test) => {
  const holder = getHolder();
  const p = getPlot([groupInfo1, groupPopulation1]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Two groups: population + poulation", (test) => {
  const holder = getHolder();
  const p = getPlot([groupPopulation1, groupPopulation2]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Single group: population", (test) => {
  const holder = getHolder();
  const p = getPlot([groupPopulation1]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Single group: filter", (test) => {
  const holder = getHolder();
  const p = getPlot([groupFilterALLmale]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
(0, import_tape.default)("Single group: info", (test) => {
  const holder = getHolder();
  const p = getPlot([groupInfo1]);
  runpp({
    holder,
    state: { plots: [p] },
    genomeBrowser: { callbacks: { "postRender.test": runTests(test, holder) } }
  });
});
function getHolder() {
  return select_default("body").append("div").style("border", "1px solid #aaa").style("padding", "5px").style("margin", "5px");
}
function getPlot(groups) {
  const p = {
    chartType: "genomeBrowser",
    geneSearchResult: { chr: "chr10", start: 61901683, stop: 62096944 }
  };
  if (groups) {
    p.snvindel = {
      details: {
        groups,
        groupTestMethods: [
          { name: "Allele frequency difference" },
          { name: "Fisher's exact test", axisLabel: "-log10(pvalue)" }
        ],
        groupTestMethodsIdx: 1
      }
    };
  }
  return p;
}
var runpp = getRunPp("mass", {
  state: {
    nav: { activeTab: 1 },
    vocab: { dslabel: "SJLife", genome: "hg38" },
    plots: [getPlot()]
  },
  debug: 1
});
function runTests(test, holder) {
  return async (gb) => {
    const div = gb.Inner.dom.holder;
    const blockDiv = await detectOne({ elem: div.node(), selector: ".sja_Block_div" });
    test.ok(blockDiv, "Block div is rendered");
    const tklst = blockDiv.querySelectorAll('[data-testid="sja_sample_menu_opener"]');
    test.equal(tklst.length, 2, "Block has 2 tracks");
    const variantTk = tklst[0];
    const variants = await detectGt({ elem: variantTk, selector: ".sja_aa_discg" });
    test.ok(variants.length > 0, "Should render variants in variants track");
    if (test._ok) holder.remove();
    test.end();
  };
}
var groupFilterAML = {
  type: "filter",
  filter: {
    type: "tvslst",
    in: true,
    join: "",
    lst: [
      {
        type: "tvs",
        tvs: {
          term: { id: "diaggrp_s", name: "Diagnosis Group", type: "categorical" },
          values: [{ key: "Acute myeloid leukemia", label: "Acute myeloid leukemia" }]
        }
      }
    ]
  }
};
var groupFilterALLmale = {
  type: "filter",
  filter: {
    type: "tvslst",
    in: true,
    join: "and",
    lst: [
      {
        type: "tvs",
        tvs: {
          term: { id: "diaggrp_s", name: "Diagnosis Group", type: "categorical" },
          values: [{ key: "Acute lymphoblastic leukemia", label: "Acute lymphoblastic leukemia" }]
        }
      },
      {
        type: "tvs",
        tvs: { term: { id: "sex_s", name: "Sex", type: "categorical" }, values: [{ key: "1", label: "Male" }] }
      }
    ]
  }
};
var groupPopulation1 = {
  type: "population",
  key: "gnomAD",
  label: "gnomAD",
  allowto_adjust_race: true,
  adjust_race: true
};
var groupPopulation2 = {
  type: "population",
  key: "TOPMed",
  label: "TOPMed",
  allowto_adjust_race: true,
  adjust_race: true
};
var groupInfo1 = { type: "info", infoKey: "AF_sjlife" };
var groupInfo2 = { type: "info", infoKey: "gnomAD_AF" };
//# sourceMappingURL=genomeBrowser.spec-DJIRW2X7.js.map
