Skip to content

Commit

Permalink
fix: fix #38
Browse files Browse the repository at this point in the history
  • Loading branch information
longfangsong committed Sep 28, 2019
1 parent 7679681 commit 6675400
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4,234 deletions.
4,257 changes: 33 additions & 4,224 deletions src/Develop/test.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/Test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function getContent(page: Page) {
describe('e2e test', function () {
this.timeout(60000);
it('can add label', async () => {
const browser = await launch({args: ['--no-sandbox']});
const browser = await launch({/*headless: false, */args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('http://localhost:8080');
expect(await countLabels(page)).eq(2);
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('e2e test', function () {
const browser = await launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('http://localhost:8080');
expect(await countConnections(page)).eq(1);
expect(await countConnections(page)).eq(2);
await selectText(page, 0, 5, 2);
await page.evaluate(() => {
let labelTexts = document.querySelectorAll(".poplar-annotation-label > g");
Expand All @@ -104,17 +104,17 @@ describe('e2e test', function () {
expect(await checkSVGElementSize(page)).true;
await page.click('.click-1');
await page.click('.click-2');
expect(await countConnections(page)).eq(2);
expect(await countConnections(page)).eq(3);
expect(await checkSVGElementSize(page)).true;
await browser.close();
});
it('can remove connection', async () => {
const browser = await launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('http://localhost:8080');
expect(await countConnections(page)).eq(1);
expect(await countConnections(page)).eq(2);
await page.click(".poplar-annotation-connection", {button: "right"});
expect(await countConnections(page)).eq(0);
expect(await countConnections(page)).eq(1);
expect(await checkSVGElementSize(page)).true;
await browser.close();
});
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('e2e test', function () {
await browser.close();
});
it('should not remove text in label', async () => {
const browser = await launch({headless: false, args: ['--no-sandbox']});
const browser = await launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('http://localhost:8080');
expect(await countLabels(page)).eq(2);
Expand Down
18 changes: 14 additions & 4 deletions src/Test/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"borderColor": "#8c7361"
},
{
"id": 1,
"id": 5,
"text": "测试Axg2",
"color": "#eac0a2",
"borderColor": "#8cff61"
Expand All @@ -22,8 +22,8 @@
"endIndex": 2
},
{
"id": 1,
"categoryId": 0,
"id": 5,
"categoryId": 5,
"startIndex": 10,
"endIndex": 13
}
Expand All @@ -32,14 +32,24 @@
{
"id": 0,
"text": "测0"
},
{
"id": 3,
"text": "测3"
}
],
"connections": [
{
"id": 0,
"categoryId": 0,
"fromId": 0,
"toId": 1
"toId": 5
},
{
"id": 3,
"categoryId": 3,
"fromId": 0,
"toId": 5
}
]
}
4 changes: 4 additions & 0 deletions src/View/Entities/ConnectionView/ConnectionCategoryElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export namespace ConnectionCategoryElement {
public create(): SVGGElement {
return this.svgElement.cloneNode(true) as SVGGElement;
}

get id() {
return this.store.id;
}
}

export interface Config {
Expand Down
4 changes: 4 additions & 0 deletions src/View/Entities/LabelView/LabelCategoryElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export namespace LabelCategoryElement {
public create(): SVGGElement {
return this.svgElement.cloneNode(true) as SVGGElement;
}

get id() {
return this.store.id;
}
}

export class FactoryRepository extends Base.Repository<Factory> {
Expand Down

0 comments on commit 6675400

Please sign in to comment.