mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 11:42:36 +00:00
b5a83f526e
* Core - Move NameConverter to IJavascriptObjectRepository - Move NameConverter property from BindingOptions to IJavascriptObjectRepository - Remove BindingOptions.CamelCaseJavascriptNames **Breaking Change** Follow up to https://github.com/cefsharp/CefSharp/commit/898ca38e7a7261b3a42c33b2abf5eac6c022ddde * Core - Javascript Binding Pluggable Naming Improvements - Added some basic unit tests (more required) - DefaultBinder now accepts a IJavascriptNameConverter passed into the constructor to allow for conversion of names * Core - Replace WeakReference with WeakReference<T>
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
// Copyright © 2020 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using CefSharp.JavascriptBinding;
|
|
using Xunit;
|
|
|
|
namespace CefSharp.Test.Framework
|
|
{
|
|
/// <summary>
|
|
/// LegacyCamelCaseJavascriptNameConverterFacts - Test the different name converters
|
|
/// </summary>
|
|
public class LegacyCamelCaseJavascriptNameConverterFacts
|
|
{
|
|
[Fact]
|
|
public void CanConvertStringToJavascriptName()
|
|
{
|
|
IJavascriptNameConverter converter = new LegacyCamelCaseJavascriptNameConverter();
|
|
var propertyInfo = new TestMemberInfo("APropertyName");
|
|
|
|
var result = converter.ConvertToJavascript(propertyInfo);
|
|
|
|
Assert.Equal("aPropertyName", result);
|
|
}
|
|
|
|
[Fact]
|
|
public void CanConvertStringToReturnedObjectName()
|
|
{
|
|
IJavascriptNameConverter converter = new LegacyCamelCaseJavascriptNameConverter();
|
|
var propertyInfo = new TestMemberInfo("APropertyName");
|
|
|
|
var result = converter.ConvertReturnedObjectPropertyAndFieldToNameJavascript(propertyInfo);
|
|
|
|
Assert.Equal(propertyInfo.Name, result);
|
|
}
|
|
}
|
|
}
|
|
|