Fix TexttestFixture

- broken after last commit which updates gilded_rose.js to use ES2015 class syntax
- creates instance of class Shop
- creates items array
- updates showItemsFor
This commit is contained in:
y0m0 committed 2017-07-12 22:23:26 +01:00
1 parent de471eb175
commit 52e4b9aeff
2 files changed
+16 -11

No files matched your search

+9 -4
View File
@@ -12,6 +12,8 @@
$('body').append('<p>OMGHAI!</p>');
items = [];
items.push(new Item('+5 Dexterity Vest', 10, 20));
items.push(new Item('Aged Brie', 2, 0));
items.push(new Item('Elixir of the Mongoose', 5, 7));
@@ -23,12 +25,15 @@
// this conjured item does not work properly yet
items.push(new Item('Conjured Mana Cake', 3, 6));
gildedRose = new Shop(items);
var days = 2;
for (var i = 0; i < days; i++) {
showHeaderFor(i);
showItemsFor(i);
update_quality();
gildedRose.updateQuality();
}
function showHeaderFor(day) {
@@ -37,9 +42,9 @@
function showItemsFor(day) {
$('body').append('<p>name, sellIn, quality</p>');
for (var j = 0; j < items.length; j++) {
var item = items[j];
$('body').append('<p>' + item.name + ', ' + item.sell_in + ', ' + item.quality + '</p>');
for (var j = 0; j < gildedRose.items.length; j++) {
var item = gildedRose.items[j];
$('body').append('<p>' + item.name + ', ' + item.sellIn + ', ' + item.quality + '</p>');
}
$('body').append('<br />');
}