Skip to content

Commit

Permalink
Merge pull request #37 from w3c/callfortranslations
Browse files Browse the repository at this point in the history
Add support for callsfortranslation endpoint
  • Loading branch information
dontcallmedom authored Mar 12, 2019
2 parents 36445a4 + 7ecd255 commit 7057318
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,15 @@ function TranslationCtx (ctx) {
// FIXME: idStep assumes subSteps has been run before
subSteps(TranslationCtx, []);
exports.translation = idStep(TranslationCtx, 'translations');

//------------------------------------- 9. Call for Translations

exports.callsfortranslation = rootList("callsfortranslation");

function CallForTranslationCtx (ctx) {
Ctx.call(this, ctx);
}

// FIXME: idStep assumes subSteps has been run before
subSteps(CallForTranslationCtx, []);
exports.callfortranslation = idStep(CallForTranslationCtx, 'callsfortranslation');
12 changes: 12 additions & 0 deletions lib/w3capi.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ function TranslationCtx (ctx) {
subSteps(TranslationCtx, []);
exports.translation = idStep(TranslationCtx, 'translations');

//------------------------------------- 9. Call for Translations

exports.callsfortranslation = rootList("callsfortranslation");

function CallForTranslationCtx (ctx) {
Ctx.call(this, ctx);
}

// FIXME: idStep assumes subSteps has been run before
subSteps(CallForTranslationCtx, []);
exports.callfortranslation = idStep(CallForTranslationCtx, 'callsfortranslation');

},{"async":2,"superagent":6,"util":14}],2:[function(require,module,exports){
(function (process,global){
(function (global, factory) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-w3capi",
"version": "1.5.1",
"version": "1.6.0",
"license": "MIT",
"description": "A JavaScript client for the W3C API",
"main": "lib/index.js",
Expand Down
9 changes: 9 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ describe('Translations', function () {
});
});

describe('Call for translations', function () {
const XHTMLBASIC = 13;
it("can be listed", function (done) {
w3c.callsfortranslation().fetch(listChecker(done, "XHTML™ Basic"));
});
it('can be fetched', function (done) {
w3c.callfortranslation(XHTMLBASIC).fetch(itemChecker(done, 'title', 'XHTML™ Basic'));
});
});

describe("Embeds", function () {
it('apply to functions', function (done) {
Expand Down

0 comments on commit 7057318

Please sign in to comment.