define([ 'taoQtiItem/qtiItem/core/Loader', 'taoQtiItem/qtiItem/core/Element', 'taoQtiItem/qtiXmlRenderer/renderers/RendererPerInteractionRP', 'json!taoQtiItem/test/samples/json/space-shuttle-m.json', 'json!taoQtiItem/test/samples/json/airports.json', 'json!taoQtiItem/test/samples/json/edinburgh.json', 'json!taoQtiItem/test/samples/json/choice-custom.json', 'json!taoQtiItem/test/samples/json/choice-feedback.json', 'json!taoQtiItem/test/samples/json/choice-feedback-complex.json', 'json!taoQtiItem/test/samples/json/rivals.json' ], function( Loader, Element, Renderer, item_shuttle, item_airports, item_edinburgh, item_custom, item_feedback, item_feedback_complex, item_rivals ) { function minXml(xml) { return xml .replace(/\/g, '') .replace(/[ \r\n\t]+xmlns/g, ' xmlns') .replace(/[\n\s]+/g, ' ') .replace(/(\s\/>)/g, '/>') .replace(/>[\n\s]?<') .trim(); } var items = [ { data: item_shuttle, comment: "choice", xml: '0

During more than 30 years, the American Space Shuttle transported 355 astronauts in space over 135 orbital launchings from Cap Canaveral, Florida. This 2046-ton Behemoth traveled 870 million kilometers around the Earth from 12th of April 1981 to 21st of July 2011. The National Aeronautics and Space Administration (NASA) built 5 Space Shuttles: Columbia, Challenger, Discovery, Atlantis and Endeavour.

Which was the last Space Shuttle going into space during the STS-135 mission in July 2011?DiscoveryChallengerPathfinderAtlantisEndeavour
1
' }, { data: item_airports, comment: "graphic interaction", xml: '

The picture illustrates four of the most popular destinations for air travellers arriving in the United Kingdom: London, Manchester, Edinburgh and Glasgow.

Which one is Glasgow?UK Map
1
' }, { data: item_edinburgh, comment: "match correct rp + areamapping attributes", xml: 'Mark Edinburgh on this map of the United Kingdom.UK Map' }, { data: item_custom, comment: "composite choice + custom rp + mapping attributes", xml: '0

Question

Sugar plum gummies lemon

Pie donut sweet jelly. Powder dessert cotton candy pie candy canes gummies gingerbread marshmallow pie.

Wafer tart oat cake tart ice cream marzipan.

(correct : +1) Topping tootsie roll halvah jelly liquorice.

Tart oat cake jelly chocolate bar cheesecake candy bonbon.

Ice cream wafer candy pie chocolate bar toffee.

Fruitcake tiramisu sesame snaps apple pie apple pie tootsie roll tart tart toffee ?

“Croissant oat cake candy canes chocolate bar.” Gummi bears

“Pudding gingerbread gummies. It apple pie jelly-o sesame (apple pie)

“Jelly beans dessert chocolate cake carrot cake pudding chupa chups cotton candy halvah lollipop. .” ( chupa chups)

(correct : +1) “Donut muffin gummies gingerbread bonbon. .” (sugar plum)

10.01.011.0
' }, { data: item_rivals, comment: "match + custom rp + mapping rp", xml: 'Hidden in this list of characters from famous Shakespeare plays are three pairs of rivals. Can you match each character to his adversary?AntonioCapuletDemetriusLysanderMontagueProspero' }, { data: item_feedback, comment: "choice + feedback rules", xml: '
Question ?choice #1choice #2choice #3
1feedbackModal_1feedbackModal_2
Right
Wrong
' }, { data: item_feedback_complex, comment: "choice + more complex feedback rules", xml: '
Question ?choice #1choice #2choice #3
1feedbackModal_10feedbackModal_2
Wrong
Good
' } ]; QUnit .cases.init(items) .test('xml rendering', function(sample, assert) { var ready = assert.async(); var loader = new Loader(), renderer = new Renderer({ shuffleChoices: false, runtimeContext: { runtime_base_www: '/taoQtiItem/test/samples/test_base_www/', root_url: '', debug: true } }); loader.loadItemData(sample.data, function(item) { assert.ok(Element.isA(item, 'assessmentItem'), sample.data.identifier + ' item loaded'); renderer.load(function() { ready(); item.setRenderer(renderer); var xml = item.render(); xml = minXml(xml); assert.equal(xml, sample.xml, 'xml equals ' + sample.comment); }, this.getLoadedClasses()); }); }); });