From 9cdef1f3cd9418024a5ed87505a6ba5af64c6adb Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 12 Jul 2016 08:14:47 +0800 Subject: [PATCH 1/1] NOCOMMIT: Test files for MDL-54915 --- lib/templates/problem.mustache | 13 +++++++++++++ lib/templates/problems.mustache | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 lib/templates/problem.mustache create mode 100644 lib/templates/problems.mustache diff --git a/lib/templates/problem.mustache b/lib/templates/problem.mustache new file mode 100644 index 0000000..8b80c6f --- /dev/null +++ b/lib/templates/problem.mustache @@ -0,0 +1,13 @@ +{{! +@template core/problem +Example context (json): {} +}} + +
This is a template whose {{#str}} javascript, local_mustacheproblems {{/str}} has not been run
+ +{{#js}} +require(['jquery'], function($) { + console.log("Running problem.mustache with {{uniqid}}"); + $('#some-span-{{uniqid}}').html('has been run'); +}) +{{/js}} diff --git a/lib/templates/problems.mustache b/lib/templates/problems.mustache new file mode 100644 index 0000000..cc71b07 --- /dev/null +++ b/lib/templates/problems.mustache @@ -0,0 +1,21 @@ +{{! +@template core/problems +Example context (json): {} +}} +
+{{#js}} +require(['jquery', 'core/templates'], function($, Templates) { + var i; + for(i = 0; i < 5; i++) { + var promise = Templates.render('core/problem', {}); + promise.done(function(html, js) { + $('#problems-foo').append(html); + console.log("{{uniqid}}"); + console.log(html); + console.log(js); + console.log("{{uniqid}}"); + Templates.runTemplateJS(js); + }); + } +}); +{{/js}} -- 2.8.3