Skip to content

Commit ca2d021

Browse files
authored
fix: Replace enableHtmlInAppMessages deprecated method with allowUserSuppliedJavascript (v4) (#61)
* fix: replace deprecated enableHtmlInAppMessages method with allowUserSuppliedJavascript * fix failing test
1 parent 3e1ed2a commit ca2d021

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/BrazeKit-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ var constructor = function () {
856856
options.sessionTimeoutInSeconds =
857857
forwarderSettings.ABKSessionTimeoutKey || 1800;
858858
options.sdkFlavor = 'mparticle';
859-
options.enableHtmlInAppMessages =
859+
options.allowUserSuppliedJavascript =
860860
forwarderSettings.enableHtmlInAppMessages == 'True';
861861
options.doNotLoadFontAwesome =
862862
forwarderSettings.doNotLoadFontAwesome == 'True';

test/tests.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,10 +1086,9 @@ describe('Braze Forwarder', function() {
10861086
window.braze.getUser().emailSet.should.equal('test2@gmail.com');
10871087

10881088
// We support $Age as a reserved attribute for Braze. However, since
1089-
// Braze's API expects a year from us, this test will break every year,
1090-
// since setting the age = 10 in 2021 will mean the user is born in 2011,
1091-
// but setting it in 2023 means the year is 2013.
1092-
window.braze.getUser().yearOfBirth.should.equal(2014);
1089+
// Braze's API expects a year, so we calculate expected year dynamically.
1090+
var expectedYearOfBirth = new Date().getFullYear() - 10;
1091+
window.braze.getUser().yearOfBirth.should.equal(expectedYearOfBirth);
10931092
window.braze.getUser().dayOfBirth.should.equal(1);
10941093
window.braze.getUser().monthOfBirth.should.equal(1);
10951094
window.braze.getUser().phoneSet.should.equal('1234567890');

0 commit comments

Comments
 (0)