Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
33
gaia/apps/calendar/test/unit/templates/account_test.js
Executable file
33
gaia/apps/calendar/test/unit/templates/account_test.js
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
define(function(require) {
|
||||
'use strict';
|
||||
|
||||
var Account = require('templates/account');
|
||||
|
||||
suite('Templates.Account', function() {
|
||||
var subject;
|
||||
|
||||
suiteSetup(function() {
|
||||
subject = Account;
|
||||
});
|
||||
|
||||
function renderHTML(type, options) {
|
||||
return subject[type].render(options);
|
||||
}
|
||||
|
||||
test('#provider', function() {
|
||||
var output = renderHTML('provider', { name: 'yahoo' });
|
||||
|
||||
assert.include(output, 'yahoo');
|
||||
assert.include(output, 'li class="yahoo" role="presentation"');
|
||||
assert.include(output, 'a data-l10n-id="preset-yahoo" role="option"');
|
||||
});
|
||||
|
||||
test('#account', function() {
|
||||
var output = renderHTML('account', { id: '1' });
|
||||
|
||||
assert.include(output, 'li id="account-1" role="presentation"');
|
||||
assert.include(output, 'a href="/update-account/1" role="option"');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
178
gaia/apps/calendar/test/unit/templates/alarm_test.js
Executable file
178
gaia/apps/calendar/test/unit/templates/alarm_test.js
Executable file
|
|
@ -0,0 +1,178 @@
|
|||
define(function(require) {
|
||||
'use strict';
|
||||
/* global MockMozIntl */
|
||||
|
||||
require('/shared/test/unit/mocks/mock_moz_intl.js');
|
||||
|
||||
var Alarm = require('templates/alarm');
|
||||
|
||||
suite('Templates.Alarm', function() {
|
||||
var subject;
|
||||
|
||||
suiteSetup(function() {
|
||||
window.mozIntl = MockMozIntl;
|
||||
subject = Alarm;
|
||||
});
|
||||
|
||||
function renderOption(value, layout, selected) {
|
||||
return subject.option.render({
|
||||
value: value,
|
||||
layout: layout,
|
||||
selected: selected
|
||||
});
|
||||
}
|
||||
|
||||
function renderDescription(layout, trigger) {
|
||||
return subject.description.render({
|
||||
layout: layout,
|
||||
trigger: trigger
|
||||
});
|
||||
}
|
||||
|
||||
suite('description', function() {
|
||||
test('minutes', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderDescription('allday', -600);
|
||||
assert.isTrue(relativePartSpy.withArgs(-600 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
|
||||
assert.include(renderDescription('allday', -600), 'role="listitem"');
|
||||
assert.include(renderDescription('standard', -600), 'role="listitem"');
|
||||
});
|
||||
|
||||
test('hours', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderDescription('allday', -6000);
|
||||
assert.isTrue(relativePartSpy.withArgs(-6000 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
|
||||
assert.include(renderDescription('allday', -6000), 'role="listitem"');
|
||||
assert.include(renderDescription('standard', -6000), 'role="listitem"');
|
||||
});
|
||||
|
||||
test('years', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderDescription('allday', -6000000);
|
||||
assert.isTrue(relativePartSpy.withArgs(-6000000 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
|
||||
assert.include(renderDescription('allday', -6000000), 'role="listitem"');
|
||||
assert.include(renderDescription('standard', -6000000),
|
||||
'role="listitem"');
|
||||
});
|
||||
|
||||
test('none', function() {
|
||||
assert.include(renderDescription('allday', 'none'), 'None');
|
||||
assert.include(renderDescription('allday', 'none'), 'role="listitem"');
|
||||
assert.include(renderDescription('standard', 'none'), 'role="listitem"');
|
||||
});
|
||||
});
|
||||
|
||||
suite('#option', function() {
|
||||
test('minutes', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-600);
|
||||
assert.isTrue(relativePartSpy.withArgs(-600 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('hours', function() {
|
||||
// One hour ago
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-6000);
|
||||
assert.isTrue(relativePartSpy.withArgs(-6000 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('years', function() {
|
||||
// Large differences are specified in weeks
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-6000000);
|
||||
assert.isTrue(relativePartSpy.withArgs(-6000000 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('none', function() {
|
||||
assert.include(renderOption('none'), 'None');
|
||||
});
|
||||
|
||||
test('single unit rendered', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-5400);
|
||||
assert.isTrue(relativePartSpy.withArgs(-5400 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
suite('selected', function() {
|
||||
test('> not selected', function() {
|
||||
assert.ok(
|
||||
renderOption(-1800).indexOf('selected') === -1,
|
||||
'not selected by default'
|
||||
);
|
||||
});
|
||||
|
||||
test('> selected', function() {
|
||||
assert.include(renderOption(-1800, null, true), 'selected');
|
||||
});
|
||||
});
|
||||
|
||||
suite('all day event alarms', function() {
|
||||
test('trigger include to system default\'s on day of event', function() {
|
||||
var option = renderOption(32400, 'allday');
|
||||
assert.include(option, 'On day of event');
|
||||
assert.include(option, 'data-l10n-id="alarm-at-event-allday"');
|
||||
});
|
||||
|
||||
test('trigger include to 9 hours before event', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-32400, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(-32400 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('trigger include to 1 day before', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-54000, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(-86400000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('trigger include to 1 day after', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(86400, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(86400 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('trigger include to 2 days before', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-140400, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(-172800000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('trigger include to 1 week before', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-572400, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(-604800000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('trigger include to 2 weeks before', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-1177200, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(-1209600000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
|
||||
test('trigger include to 30 minutes', function() {
|
||||
var relativePartSpy = sinon.spy(window.mozIntl._gaia, 'relativePart');
|
||||
renderOption(-1800, 'allday');
|
||||
assert.isTrue(relativePartSpy.withArgs(-1800 * 1000).calledOnce);
|
||||
window.mozIntl._gaia.relativePart.restore();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
74
gaia/apps/calendar/test/unit/templates/calendar_test.js
Executable file
74
gaia/apps/calendar/test/unit/templates/calendar_test.js
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
define(function(require) {
|
||||
'use strict';
|
||||
|
||||
var Calendar = require('templates/calendar');
|
||||
var localCalendarId = require('common/constants').localCalendarId;
|
||||
|
||||
suite('Templates.Calendar', function() {
|
||||
var subject;
|
||||
|
||||
suiteSetup(function() {
|
||||
subject = Calendar;
|
||||
});
|
||||
|
||||
function renderHTML(type, options) {
|
||||
return subject[type].render(options);
|
||||
}
|
||||
|
||||
test('#item with local id', function() {
|
||||
var model = {
|
||||
localDisplayed: true,
|
||||
_id: localCalendarId,
|
||||
name: 'foo',
|
||||
color: '#BADA55'
|
||||
};
|
||||
|
||||
var output = renderHTML('item', model);
|
||||
assert.ok(output);
|
||||
assert.match(output, /calendar-local-first"\s+role="presentation"/);
|
||||
assert.match(output,
|
||||
/icon-calendar-dot"\s+style="color:#BADA55"\s+aria-hidden="true"/);
|
||||
assert.include(output, 'calendar-local');
|
||||
});
|
||||
|
||||
test('#item not local displayed', function() {
|
||||
var model = {
|
||||
localDisplayed: false,
|
||||
_id: localCalendarId,
|
||||
name: 'foo'
|
||||
};
|
||||
|
||||
var output = renderHTML('item', model);
|
||||
assert.ok(output);
|
||||
assert.match(output, /gaia-checkbox/);
|
||||
});
|
||||
|
||||
test('#item', function() {
|
||||
var model = {
|
||||
localDisplayed: true,
|
||||
_id: 1,
|
||||
name: 'cal name'
|
||||
};
|
||||
|
||||
var output = renderHTML('item', model);
|
||||
assert.ok(output);
|
||||
|
||||
assert.include(output, 'checked');
|
||||
assert.include(output, model.name);
|
||||
assert.include(output, 'calendar-1');
|
||||
|
||||
assert.ok(
|
||||
output.indexOf('calendar-local') === -1,
|
||||
'does not include calendar-local l10n id'
|
||||
);
|
||||
|
||||
model.localDisplayed = false;
|
||||
output = renderHTML('item', model);
|
||||
|
||||
var selected = output.indexOf('checked') !== -1;
|
||||
assert.isFalse(selected);
|
||||
assert.include(output, model.name);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
112
gaia/apps/calendar/test/unit/templates/duration_time_test.js
Executable file
112
gaia/apps/calendar/test/unit/templates/duration_time_test.js
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
define(function(require) {
|
||||
'use strict';
|
||||
var DurationTime = require('templates/duration_time');
|
||||
|
||||
suite('DurationTime', function() {
|
||||
var subject;
|
||||
|
||||
suiteSetup(function() {
|
||||
window.IntlHelper.define('shortTimeFormat', 'datetime', {
|
||||
hour: 'numeric',
|
||||
minute: 'numeric'
|
||||
});
|
||||
subject = DurationTime;
|
||||
});
|
||||
|
||||
function renderDurationTime(options) {
|
||||
return subject.durationTime.render(options);
|
||||
}
|
||||
|
||||
suite('#durationTime', function() {
|
||||
var container;
|
||||
|
||||
setup(function() {
|
||||
container = document.createElement('div');
|
||||
document.body.appendChild(container);
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
container.parentNode.removeChild(container);
|
||||
});
|
||||
|
||||
test('one day', function() {
|
||||
var startDate = new Date('1991-09-08T10:10:00');
|
||||
var endDate = new Date('1991-09-08T17:17:00');
|
||||
var durationDescription = renderDurationTime({
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
isAllDay: false
|
||||
});
|
||||
|
||||
container.innerHTML = durationDescription;
|
||||
var spans = container.querySelectorAll('span');
|
||||
assert.include(
|
||||
spans[0].dataset.date,
|
||||
'Sun Sep 08 1991 10:10:00',
|
||||
'start time'
|
||||
);
|
||||
assert.include(
|
||||
spans[1].dataset.date,
|
||||
'Sun Sep 08 1991 17:17:00',
|
||||
'end time'
|
||||
);
|
||||
});
|
||||
|
||||
test('multiple day', function() {
|
||||
var startDate = new Date('1991-09-08T10:10:00');
|
||||
var endDate = new Date('1991-09-15T17:17:00');
|
||||
var durationDescription = renderDurationTime({
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
isAllDay: false
|
||||
});
|
||||
|
||||
container.innerHTML = durationDescription;
|
||||
var spans = container.querySelectorAll('span');
|
||||
assert.include(
|
||||
spans[0].dataset.date,
|
||||
'Sun Sep 08 1991 10:10:00',
|
||||
'start time'
|
||||
);
|
||||
assert.include(
|
||||
spans[1].dataset.date,
|
||||
'Sun Sep 15 1991 17:17:00',
|
||||
'end time'
|
||||
);
|
||||
});
|
||||
|
||||
test('one all day', function() {
|
||||
var startDate = new Date('1991-09-08T00:00:00');
|
||||
var endDate = new Date('1991-09-09T00:00:00');
|
||||
var durationDescription = renderDurationTime({
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
isAllDay: true
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
durationDescription,
|
||||
'All day<br>' +
|
||||
'Sunday, September 8, 1991'
|
||||
);
|
||||
});
|
||||
|
||||
test('multiple all day', function() {
|
||||
var startDate = new Date('1991-09-08T00:00:00');
|
||||
var endDate = new Date('1991-09-15T00:00:00');
|
||||
var durationDescription = renderDurationTime({
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
isAllDay: true
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
durationDescription,
|
||||
'All day from Sunday, September 8, 1991<br>' +
|
||||
'to Saturday, September 14, 1991'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
81
gaia/apps/calendar/test/unit/templates/month_day_agenda_test.js
Executable file
81
gaia/apps/calendar/test/unit/templates/month_day_agenda_test.js
Executable file
|
|
@ -0,0 +1,81 @@
|
|||
define(function(require) {
|
||||
'use strict';
|
||||
|
||||
var intl = require('intl');
|
||||
|
||||
var MonthDayAgenda = require('templates/month_day_agenda');
|
||||
|
||||
suite('templates/month_day_agenda', function() {
|
||||
function renderHTML(type, options) {
|
||||
return MonthDayAgenda[type].render(options);
|
||||
}
|
||||
|
||||
suiteSetup(function() {
|
||||
intl.init();
|
||||
});
|
||||
|
||||
suite('#event', function() {
|
||||
test('> regular event', function() {
|
||||
var result = renderHTML('event', {
|
||||
hasAlarms: true,
|
||||
busytimeId: 55,
|
||||
calendarId: 42,
|
||||
title: 'Lorem Ipsum',
|
||||
location: 'Dolor Sit Amet',
|
||||
attendees: null,
|
||||
startTime: new Date('October 13, 2014 12:34:00'),
|
||||
endTime: new Date('October 13, 2014 16:56:00'),
|
||||
isAllDay: false,
|
||||
color: '#0000ff'
|
||||
});
|
||||
|
||||
assert.include(result, 'has-alarms');
|
||||
assert.include(result, 'href="/event/show/55/"');
|
||||
assert.include(result,
|
||||
'<h5 role="presentation" dir="auto">Lorem Ipsum</h5>');
|
||||
assert.include(result, 'Dolor Sit Amet');
|
||||
assert.include(result, '12:34');
|
||||
assert.include(result, '16:56');
|
||||
assert.include(result, 'role="option"');
|
||||
assert.include(result, '<div class="gaia-icon icon-calendar-dot" ' +
|
||||
'style="color:#0000ff"');
|
||||
assert.match(result,
|
||||
/icon-calendar-dot" style="color:#0000ff"\s+aria-hidden="true">/);
|
||||
assert.match(result, /id="55-icon-calendar-alarm"\s+aria-hidden="true"/);
|
||||
assert.include(result, 'aria-describedby="55-icon-calendar-alarm"');
|
||||
});
|
||||
|
||||
test('> all day event', function() {
|
||||
var result = renderHTML('event', {
|
||||
hasAlarms: false,
|
||||
busytimeId: 55,
|
||||
calendarId: 42,
|
||||
title: 'Lorem Ipsum',
|
||||
location: 'Dolor Sit Amet',
|
||||
attendees: null,
|
||||
startTime: new Date('October 13, 2014 12:34:00'),
|
||||
endTime: new Date('October 13, 2014 16:56:00'),
|
||||
isAllDay: true,
|
||||
color: '#ff0033'
|
||||
});
|
||||
|
||||
assert.equal(result.indexOf('has-alarms'), -1, 'no alarm');
|
||||
assert.include(result, 'href="/event/show/55/"');
|
||||
assert.include(result,
|
||||
'<h5 role="presentation" dir="auto">Lorem Ipsum</h5>');
|
||||
assert.include(result, 'Dolor Sit Amet');
|
||||
assert.include(result, 'data-l10n-id="hour-allday"');
|
||||
assert.include(result, 'role="option"');
|
||||
assert.include(result, '<div class="gaia-icon icon-calendar-dot" ' +
|
||||
'style="color:#ff0033"');
|
||||
assert.match(result,
|
||||
/icon-calendar-dot" style="color:#ff0033"\s+aria-hidden="true">/);
|
||||
assert.include(result, 'id="55-icon-calendar-alarm" aria-hidden="true"');
|
||||
assert.include(result, 'aria-describedby="55-icon-calendar-alarm"');
|
||||
assert.ok(result.indexOf('12:34') === -1, 'include start time');
|
||||
assert.ok(result.indexOf('16:56') === -1, 'include end time');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue