-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [#110] Add support for Ora * Bump version number to 2.1.0
- Loading branch information
1 parent
dd58313
commit 522892d
Showing
6 changed files
with
123 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"private": true, | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"name": "tickety-tick", | ||
"description": "A browser extension that helps you to create commit messages and branch names from story trackers.", | ||
"author": "Bodo Tasche <[email protected]>", | ||
|
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,85 @@ | ||
import { JSDOM } from 'jsdom'; | ||
|
||
import adapter from '../../src/common/adapters/ora'; | ||
|
||
function task({ id, title, type }) { | ||
return ` | ||
<div class="single-task-modal" id="task-modal"> | ||
<div class="sub-stats-container"> | ||
<!-- … --> | ||
</div> | ||
<div class="header"> | ||
<form data-ng-submit="updateTaskTitle(currentTask,taskTitle)"> | ||
<textarea id="task-title">${title}</textarea> | ||
</form> | ||
</div> | ||
<div class="under-title-container"> | ||
<div data-ng-hide="::!editRights" class="submenu"> | ||
<div data-ng-if="features.visible_id" class="task-id"> | ||
<span>#${id}</span> | ||
</div> | ||
<div data-ng-if="features['task_types']" data-is-open="taskTypesPopover.open"> | ||
<div class="text dropdown-toggle" aria-expanded="false"> | ||
<span class="hide-mobile capitalize-first-letter truncate70">${type}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="content"> | ||
<div class="extras"> | ||
<div> | ||
<div data-ng-if="description && !taskDescriptionEdit"> | ||
<p>A description paragraph</p> | ||
<ul> | ||
<li>list item 0</li> | ||
<li>list item 1 with a mention <a data-uib-tooltip="Search for Regulations" class="mention">#42</a>)</li> | ||
<li>list item 2</li> | ||
</ul> | ||
<p>…and more text</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
|
||
describe('ora adapter', () => { | ||
const loc = { host: 'ora.pm', pathname: '/project/53123/kanban/task/641617' }; | ||
|
||
function doc(body) { | ||
const { window } = new JSDOM(`<html><body>${body}</body></html>`); | ||
return window.document; | ||
} | ||
|
||
it('returns null if it is on a different page', () => { | ||
adapter.inspect({ host: 'github.com' }, null, (err, res) => { | ||
expect(err).toBe(null); | ||
expect(res).toBe(null); | ||
}); | ||
}); | ||
|
||
it('extracts feature tickets', () => { | ||
const ticket = { id: 'ORA12', title: 'Random Ora task title', type: 'feature' }; | ||
adapter.inspect(loc, doc(task(ticket)), (err, res) => { | ||
expect(err).toBe(null); | ||
expect(res).toEqual([ticket]); | ||
}); | ||
}); | ||
|
||
it('extracts chore tickets', () => { | ||
const ticket = { id: 'ORA12', title: 'Random Ora task title', type: 'chore' }; | ||
adapter.inspect(loc, doc(task(ticket)), (err, res) => { | ||
expect(err).toBe(null); | ||
expect(res).toEqual([ticket]); | ||
}); | ||
}); | ||
|
||
it('extracts bug tickets', () => { | ||
const ticket = { id: 'ORA12', title: 'Random Ora task title', type: 'bug' }; | ||
adapter.inspect(loc, doc(task(ticket)), (err, res) => { | ||
expect(err).toBe(null); | ||
expect(res).toEqual([ticket]); | ||
}); | ||
}); | ||
}); |
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,28 @@ | ||
import { | ||
$find, | ||
$has, | ||
$text, | ||
} from './helpers'; | ||
|
||
function identifier(value) { | ||
if (typeof value === 'string') return value.replace(/^#/, ''); | ||
return null; | ||
} | ||
|
||
const adapter = { | ||
inspect(loc, doc, fn) { | ||
if (loc.host !== 'ora.pm') return fn(null, null); | ||
|
||
if ($has('#task-modal.single-task-modal', doc)) { | ||
const task = $find('#task-modal.single-task-modal', doc); | ||
const id = identifier($text('.task-id', task)); | ||
const title = $text('#task-title', task); | ||
const type = $text('[data-ng-if="features[\'task_types\']"]', task) || 'feature'; | ||
return fn(null, [{ id, title, type }]); | ||
} | ||
|
||
return fn(null, null); | ||
}, | ||
}; | ||
|
||
export default adapter; |
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