@api-components/http-method-selector
Version:
59 lines (55 loc) • 1.82 kB
HTML
<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>
<link rel="import" href="../http-method-selector-mini.html">
</head>
<body>
<test-fixture id="basic">
<template>
<http-method-selector-mini></http-method-selector-mini>
</template>
</test-fixture>
<script>
/* global fixture, assert */
suite('basic', () => {
let element;
setup(() => {
element = fixture('basic');
});
test('isPayload is false for GET method', () => {
assert.isFalse(element.isPayload);
});
test('isPayload is false for HEAD method', () => {
element.method = 'HEAD';
assert.isFalse(element.isPayload);
});
test('isPayload is true for other methods', () => {
element.method = 'PUT';
assert.isTrue(element.isPayload);
element.method = 'POST';
assert.isTrue(element.isPayload);
element.method = 'DELETE';
assert.isTrue(element.isPayload);
element.method = 'PATCH';
assert.isTrue(element.isPayload);
});
test('isPayload is true for non-standard method', () => {
element.method = 'X-METHOD';
assert.isTrue(element.isPayload);
});
test('showCustom is false for standard method', () => {
element.method = 'HEAD';
assert.isFalse(element.showCustom);
});
test('showCustom is true for non-standard method', () => {
element.method = 'X-METHOD';
assert.isTrue(element.showCustom);
});
});
</script>
</body>
</html>