Using html() makes it possible to insert <script> tags in the DOM, and in this case we aren't supposed to be inserting any HTML. I haven't found a way to focus on a field with Capybara, then add a character, and focus on another field. So I've manually triggered the change event in the test.
29 lines
794 B
JavaScript
29 lines
794 B
JavaScript
(function() {
|
|
"use strict";
|
|
App.Banners = {
|
|
initialize: function() {
|
|
$("[data-js-banner-title]").on({
|
|
change: function() {
|
|
$("#js-banner-title").text($(this).val());
|
|
}
|
|
});
|
|
$("[data-js-banner-description]").on({
|
|
change: function() {
|
|
$("#js-banner-description").text($(this).val());
|
|
}
|
|
});
|
|
$("[name='banner[background_color]']").on({
|
|
change: function() {
|
|
$("#js-banner-background").css("background-color", $(this).val());
|
|
}
|
|
});
|
|
$("[name='banner[font_color]']").on({
|
|
change: function() {
|
|
$("#js-banner-title").css("color", $(this).val());
|
|
$("#js-banner-description").css("color", $(this).val());
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}).call(this);
|