mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-22 09:46:42 +02:00
#1055 Better selectors
This commit is contained in:
@@ -16,7 +16,7 @@ describe('Interaction', () => {
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.get('body')
|
||||
.find('g#mermaid-dom-id-1Function')
|
||||
.find('g[id="1Function"]')
|
||||
.click();
|
||||
|
||||
cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
|
||||
@@ -38,7 +38,7 @@ describe('Interaction', () => {
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.get('body')
|
||||
.find('g#mermaid-dom-id-2URL')
|
||||
.find('g[id="2URL"]')
|
||||
.click();
|
||||
|
||||
cy.location().should(location => {
|
||||
@@ -108,7 +108,7 @@ describe('Interaction', () => {
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.get('body')
|
||||
.find('g#mermaid-dom-id-1Function')
|
||||
.find('g[id="1Function"]')
|
||||
.click();
|
||||
|
||||
cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow');
|
||||
@@ -130,7 +130,7 @@ describe('Interaction', () => {
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.get('body')
|
||||
.find('g#mermaid-dom-id-2URL')
|
||||
.find('g[id="2URL"]')
|
||||
.click();
|
||||
|
||||
cy.location().should(location => {
|
||||
@@ -200,7 +200,7 @@ describe('Interaction', () => {
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.get('body')
|
||||
.find('g#mermaid-dom-id-1Function')
|
||||
.find('g[id="1Function"]')
|
||||
.click();
|
||||
|
||||
cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow');
|
||||
|
@@ -4,7 +4,8 @@ import { logger } from '../../logger';
|
||||
import utils from '../../utils';
|
||||
import { getConfig } from '../../config';
|
||||
|
||||
const MERMAID_DOM_ID_PREFIX = 'mermaid-dom-id-';
|
||||
// const MERMAID_DOM_ID_PREFIX = 'mermaid-dom-id-';
|
||||
const MERMAID_DOM_ID_PREFIX = '';
|
||||
|
||||
const config = getConfig();
|
||||
let vertices = {};
|
||||
|
@@ -460,8 +460,8 @@ export const draw = function(text, id) {
|
||||
subG = subGraphs[i];
|
||||
|
||||
if (subG.title !== 'undefined') {
|
||||
const clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect');
|
||||
const clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id);
|
||||
const clusterRects = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"] rect');
|
||||
const clusterEl = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"]');
|
||||
|
||||
const xPos = clusterRects[0].x.baseVal.value;
|
||||
const yPos = clusterRects[0].y.baseVal.value;
|
||||
@@ -475,7 +475,7 @@ export const draw = function(text, id) {
|
||||
|
||||
// Add label rects for non html labels
|
||||
if (!conf.htmlLabels) {
|
||||
const labels = document.querySelectorAll('#' + id + ' .edgeLabel .label');
|
||||
const labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||
for (let k = 0; k < labels.length; k++) {
|
||||
const label = labels[k];
|
||||
|
||||
|
Reference in New Issue
Block a user