Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/linting-and-testing

This commit is contained in:
Kyle Shockey
2017-03-23 16:43:37 -07:00
5 changed files with 72 additions and 8 deletions

View File

@@ -396,7 +396,7 @@ describe("createXMLExample", function () {
})
it("returns array with default values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n</animals>"
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
items: {
"enum": ["one", "two"],
@@ -405,6 +405,7 @@ describe("createXMLExample", function () {
name: "animal"
}
},
"default": ["1", "2"],
xml: {
wrapped: true,
name: "animals"
@@ -413,8 +414,53 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
it("returns array with example values with ", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
type: "object",
properties: {
"animal": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"1",
"2"
]
}
},
xml: {
name: "animals"
}
}
expect(sut(definition)).toEqual(expected)
})
it("returns array with example values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
type: "array",
items: {
type: "string",
xml: {
name: "animal"
}
},
"example": [ "1", "2" ],
xml: {
wrapped: true,
name: "animals"
}
}
expect(sut(definition)).toEqual(expected)
})
})
describe("object", function () {
it("returns object with 2 properties", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"