Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
custom theme robot and user images are now set using javascript and n…
…ot as overrides in theme scss. Fixes issue #315
- Loading branch information
1 parent
082c606
commit ae288fa
Showing
8 changed files
with
92 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
describe('Custom user and robot images', function() { | ||
var photo = 'https://space10-community.github.io/conversational-form/landingpage/photo2.jpg'; | ||
|
||
var tags = [ | ||
{ | ||
"tag": "input", | ||
"type": "text", | ||
"name": "max-min-length", | ||
"minlength": 5, | ||
"maxlength": 15, | ||
} | ||
]; | ||
|
||
var instanceDefault = window.cf.ConversationalForm.startTheConversation({ | ||
"options": { | ||
formEl: document.createElement("form"), | ||
"submitCallback": function(){}, | ||
}, | ||
"tags": tags | ||
}); | ||
|
||
var instanceRobotImage = window.cf.ConversationalForm.startTheConversation({ | ||
"options": { | ||
formEl: document.createElement("form"), | ||
"submitCallback": function(){}, | ||
robotImage: photo, | ||
userImage: photo, | ||
}, | ||
"tags": tags | ||
}); | ||
|
||
var instanceDark = window.cf.ConversationalForm.startTheConversation({ | ||
"options": { | ||
formEl: document.createElement("form"), | ||
"submitCallback": function(){}, | ||
theme: 'dark' | ||
}, | ||
"tags": tags | ||
}); | ||
|
||
var instanceDarkRobotImage = window.cf.ConversationalForm.startTheConversation({ | ||
"options": { | ||
formEl: document.createElement("form"), | ||
"submitCallback": function(){}, | ||
robotImage: photo, | ||
userImage: photo, | ||
theme: 'dark' | ||
}, | ||
"tags": tags | ||
}); | ||
|
||
it('Theme should have a svg as value (default)', function() { | ||
expect(instanceDefault.dictionary.robotData['robot-image']).toContain('svg+xml'); | ||
expect(instanceDefault.dictionary.data['user-image']).toContain('svg+xml'); | ||
}); | ||
|
||
it('Theme should have custom photo as robotImage', function() { | ||
expect(instanceRobotImage.dictionary.robotData['robot-image']).toEqual(photo); | ||
expect(instanceRobotImage.dictionary.data['user-image']).toEqual(photo); | ||
}); | ||
|
||
it('Dark Theme should have a svg as value (default)', function() { | ||
expect(instanceDark.dictionary.robotData['robot-image']).toContain('svg+xml'); | ||
expect(instanceDark.dictionary.data['user-image']).toContain('svg+xml'); | ||
}); | ||
|
||
it('Dark Theme should have custom photo as robotImage', function() { | ||
expect(instanceDarkRobotImage.dictionary.robotData['robot-image']).toEqual(photo); | ||
expect(instanceDarkRobotImage.dictionary.data['user-image']).toEqual(photo); | ||
}); | ||
|
||
|
||
}); |