Skip to content

Commit 7057318

Browse files
Merge pull request #37 from w3c/callfortranslations
Add support for callsfortranslation endpoint
2 parents 36445a4 + 7ecd255 commit 7057318

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

lib/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,15 @@ function TranslationCtx (ctx) {
241241
// FIXME: idStep assumes subSteps has been run before
242242
subSteps(TranslationCtx, []);
243243
exports.translation = idStep(TranslationCtx, 'translations');
244+
245+
//------------------------------------- 9. Call for Translations
246+
247+
exports.callsfortranslation = rootList("callsfortranslation");
248+
249+
function CallForTranslationCtx (ctx) {
250+
Ctx.call(this, ctx);
251+
}
252+
253+
// FIXME: idStep assumes subSteps has been run before
254+
subSteps(CallForTranslationCtx, []);
255+
exports.callfortranslation = idStep(CallForTranslationCtx, 'callsfortranslation');

lib/w3capi.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ function TranslationCtx (ctx) {
243243
subSteps(TranslationCtx, []);
244244
exports.translation = idStep(TranslationCtx, 'translations');
245245

246+
//------------------------------------- 9. Call for Translations
247+
248+
exports.callsfortranslation = rootList("callsfortranslation");
249+
250+
function CallForTranslationCtx (ctx) {
251+
Ctx.call(this, ctx);
252+
}
253+
254+
// FIXME: idStep assumes subSteps has been run before
255+
subSteps(CallForTranslationCtx, []);
256+
exports.callfortranslation = idStep(CallForTranslationCtx, 'callsfortranslation');
257+
246258
},{"async":2,"superagent":6,"util":14}],2:[function(require,module,exports){
247259
(function (process,global){
248260
(function (global, factory) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-w3capi",
3-
"version": "1.5.1",
3+
"version": "1.6.0",
44
"license": "MIT",
55
"description": "A JavaScript client for the W3C API",
66
"main": "lib/index.js",

test/api.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ describe('Translations', function () {
195195
});
196196
});
197197

198+
describe('Call for translations', function () {
199+
const XHTMLBASIC = 13;
200+
it("can be listed", function (done) {
201+
w3c.callsfortranslation().fetch(listChecker(done, "XHTML™ Basic"));
202+
});
203+
it('can be fetched', function (done) {
204+
w3c.callfortranslation(XHTMLBASIC).fetch(itemChecker(done, 'title', 'XHTML™ Basic'));
205+
});
206+
});
198207

199208
describe("Embeds", function () {
200209
it('apply to functions', function (done) {

0 commit comments

Comments
 (0)