diff --git a/lib/builders/Chip.js b/lib/builders/Chip.js
index 83d2f7a9..eee4ed35 100644
--- a/lib/builders/Chip.js
+++ b/lib/builders/Chip.js
@@ -41,14 +41,24 @@ function chipBuilder (builder, definition) {
function badgeBuilder (builder, definition) {
const {
icon,
- text
+ text,
+ topSpacing
} = definition
const badge = builder
.addTag('q-badge')
- .addAttribute('class', 'q-mt-md q-mr-sm q-mb-none q-ml-none')
.addAttribute('multi-line', null)
+ let classes = 'q-mr-sm q-mb-none q-ml-none'
+ if (!topSpacing || topSpacing === 'medium') {
+ classes += ' q-mt-md'
+ } else if (topSpacing === 'small') {
+ classes += ' q-mt-sm'
+ } else if (topSpacing === 'none') {
+ classes += ' q-mt-none'
+ }
+ badge.addAttribute('class', classes)
+
if (icon) {
badge
.addChildTag('q-icon')
diff --git a/lib/builders/TimelineEntry.js b/lib/builders/TimelineEntry.js
index 9f0fa88d..90589e37 100644
--- a/lib/builders/TimelineEntry.js
+++ b/lib/builders/TimelineEntry.js
@@ -32,6 +32,14 @@ module.exports = function (definition, options) {
.addChildTag('template')
.addAttribute('v-slot:title', null)
+ if (showLaunches) {
+ const launchesParent = titleTemplate
+ .addChildTag('div')
+ .addAttribute('class', 'float-right')
+
+ applyLaunches(launchesParent, definition)
+ }
+
const titleDivRow = titleTemplate
.addChildTag('div')
.addAttribute('class', 'row')
@@ -44,14 +52,6 @@ module.exports = function (definition, options) {
titleCol.content(title)
}
- if (showLaunches) {
- const launchesParent = titleDivRow
- .addChildTag('div')
- .addAttribute('class', 'col-auto')
-
- applyLaunches(launchesParent, definition)
- }
-
const subtitleTemplate = entry
.addChildTag('template')
.addAttribute('v-slot:subtitle', null)
diff --git a/test/chip-tests.js b/test/chip-tests.js
new file mode 100644
index 00000000..b43847ed
--- /dev/null
+++ b/test/chip-tests.js
@@ -0,0 +1,68 @@
+/* eslint-env mocha */
+
+'use strict'
+const Chip = require('./../lib/builders/Chip')
+const chai = require('chai')
+const expect = chai.expect
+
+describe('badge construction tests', function () {
+ it('just text', function () {
+ const badge = Chip({
+ style: 'badge',
+ icon: null,
+ text: 'TEXT',
+ topSpacing: null
+ }, null)
+ expect(badge).to.eql('TEXT')
+ })
+
+ it('icon and text', function () {
+ const badge = Chip({
+ style: 'badge',
+ icon: 'repeat',
+ text: 'TEXT',
+ topSpacing: null
+ }, null)
+ expect(badge).to.eql('TEXT')
+ })
+
+ it('icon and text with undefined top spacing', function () {
+ const badge = Chip({
+ style: 'badge',
+ icon: 'repeat',
+ text: 'TEXT',
+ topSpacing: null
+ }, null)
+ expect(badge).to.eql('TEXT')
+ })
+
+ it('icon and text with medium (default) top spacing', function () {
+ const badge = Chip({
+ style: 'badge',
+ icon: 'repeat',
+ text: 'TEXT',
+ topSpacing: 'medium'
+ }, null)
+ expect(badge).to.eql('TEXT')
+ })
+
+ it('icon and text with small top spacing', function () {
+ const badge = Chip({
+ style: 'badge',
+ icon: 'repeat',
+ text: 'TEXT',
+ topSpacing: 'small'
+ }, null)
+ expect(badge).to.eql('TEXT')
+ })
+
+ it('icon and text with no top spacing', function () {
+ const badge = Chip({
+ style: 'badge',
+ icon: 'repeat',
+ text: 'TEXT',
+ topSpacing: 'none'
+ }, null)
+ expect(badge).to.eql('TEXT')
+ })
+})
diff --git a/test/timeline-entry-test.js b/test/timeline-entry-test.js
new file mode 100644
index 00000000..1e7bb2a0
--- /dev/null
+++ b/test/timeline-entry-test.js
@@ -0,0 +1,32 @@
+/* eslint-env mocha */
+
+'use strict'
+const TimelineEntry = require('./../lib/builders/TimelineEntry')
+const chai = require('chai')
+const expect = chai.expect
+
+describe('timeline entry construction tests', function () {
+ it('just a title', function () {
+ const timelineEntry = TimelineEntry({
+ icon: null,
+ color: null,
+ title: 'TITLE',
+ subtitle: null,
+ showWhen: null,
+ showLaunches: null
+ }, null)
+ expect(timelineEntry).to.eql('')
+ })
+
+ it('title and subtitle', function () {
+ const timelineEntry = TimelineEntry({
+ icon: null,
+ color: null,
+ title: 'TITLE',
+ subtitle: 'SUBTITLE',
+ showWhen: null,
+ showLaunches: null
+ }, null)
+ expect(timelineEntry).to.eql('SUBTITLE')
+ })
+})