This repository has been archived by the owner on Sep 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
496 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<!doctype html> | ||
<!-- | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
<script src="../../iron-test-helpers/test-helpers.js"></script> | ||
<script src="../../iron-test-helpers/mock-interactions.js"></script> | ||
<script src="test-helper.js"></script> | ||
<link rel="import" href="../import-panel.html"> | ||
<link rel="import" href="../../arc-demo-helpers/data-generator.html"> | ||
<link rel="import" href="../../arc-data-import/arc-data-import.html"> | ||
</head> | ||
<body> | ||
|
||
<test-fixture id="basic"> | ||
<template> | ||
<import-panel></import-panel> | ||
<arc-data-import></arc-data-import> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
/* global fixture, assert, DataGenerator */ | ||
suite('basic', function() { | ||
var importData; | ||
suiteSetup(function() { | ||
var saved = DataGenerator.generateSavedRequestData({ | ||
requestsSize: 10, | ||
projectsSize: 1 | ||
}); | ||
var history = DataGenerator.generateHistoryRequestsData({ | ||
requestsSize: 10 | ||
}); | ||
importData = { | ||
kind: 'ARC#Import', | ||
createdAt: '2017-09-28T19:43:09.491', | ||
version: '9.14.64.305', | ||
requests: saved.requests, | ||
projects: saved.projects, | ||
history: history, | ||
variables: DataGenerator.generateVariablesData(), | ||
'headers-sets': DataGenerator.generateHeadersSetsData(), | ||
cookies: DataGenerator.generateCookiesData(), | ||
'url-history': DataGenerator.generateUrlsData(), | ||
'websocket-url-history': DataGenerator.generateUrlsData() | ||
}; | ||
}); | ||
|
||
var element; | ||
setup(function() { | ||
element = fixture('basic')[0]; | ||
element.data = DataGenerator.clone(importData); | ||
element.selectedPage = 3; | ||
}); | ||
|
||
test('Sends the import-data custom event', function(done) { | ||
element.addEventListener('import-data', function f(e) { | ||
element.removeEventListener('import-data', f); | ||
assert.isTrue(e.cancelable, 'Event is cancelable.'); | ||
assert.equal(e.detail.content, importData); | ||
done(); | ||
}); | ||
element._importData({ | ||
detail: importData | ||
}); | ||
}); | ||
|
||
test('Sets the importing flag', function() { | ||
element._importData({ | ||
detail: importData | ||
}); | ||
assert.isTrue(element.importing, 'importing is set.'); | ||
}); | ||
|
||
test('Clears the state after import', function() { | ||
return element._importData({ | ||
detail: importData | ||
}) | ||
.then(() => { | ||
assert.isFalse(element.importing, 'importing is set.'); | ||
assert.isUndefined(element.data, 'data is set.'); | ||
assert.equal(element.selectedPage, 0, 'selected page is set.'); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<!doctype html> | ||
<!-- | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
<script src="../../iron-test-helpers/test-helpers.js"></script> | ||
<script src="../../iron-test-helpers/mock-interactions.js"></script> | ||
<script src="test-helper.js"></script> | ||
<link rel="import" href="../../arc-data-import/arc-data-import.html"> | ||
<link rel="import" href="../import-panel.html"> | ||
</head> | ||
<body> | ||
|
||
<test-fixture id="basic"> | ||
<template> | ||
<import-panel></import-panel> | ||
<arc-data-import></arc-data-import> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
/* global fixture, assert, MockInteractions, DataTestHelper */ | ||
suite('basic', function() { | ||
var importData; | ||
suiteSetup(function() { | ||
return DataTestHelper.getFile('import-data-test.json') | ||
.then(response => { | ||
importData = response; | ||
}); | ||
}); | ||
|
||
var element; | ||
setup(function() { | ||
element = fixture('basic')[0]; | ||
element.selectedPage = 2; | ||
element.$$('#manualInput').value = importData; | ||
}); | ||
|
||
function normalize() { | ||
var button = element.$$('[data-action="import-text"]'); | ||
MockInteractions.tap(button); | ||
} | ||
|
||
test('Sends the import-normalize custom event', function(done) { | ||
element.addEventListener('import-normalize', function f(e) { | ||
element.removeEventListener('import-normalize', f); | ||
assert.isTrue(e.cancelable, 'Event is cancelable.'); | ||
assert.equal(e.detail.content, importData); | ||
done(); | ||
}); | ||
normalize(); | ||
}); | ||
|
||
test('_processContent returns a Promise', function() { | ||
return element._processContent(importData) | ||
.then(() => {}); | ||
}); | ||
|
||
test('Opens a table after normalization', function() { | ||
return element._processContent(importData) | ||
.then(() => { | ||
assert.equal(element.selectedPage, 3); | ||
}); | ||
}); | ||
|
||
test('Sets the data after normalization', function() { | ||
return element._processContent(importData) | ||
.then(() => { | ||
assert.typeOf(element.data, 'object'); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.